I am creating a code that generates image from HTML code. I am using puppeteer library which server this purpose (converting html template into an image).
My goal is having a job arrives to a script element point to trigger the script to generate the image.
The issue I am encountering is that the script requires to set the path where you want to save the generated image.
Any idea how can I set the script to generate the image and "SendToSingle()" be the path where the image is created, so that image continues the journey through the flow.
This is the script I am using
Code: Select all
async function jobArrived(s,flowElement,job){
const puppeteer = require('puppeteer')
const htmlString = `<html>
<body>
<head>
<p>HTML CODE</p>
</body>
</html>`;
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.setContent(htmlString)
await page.screenshot({path: THIS IS WHERE THE SCRIPT WANTS ME TO PUT THE PATH WHERE TO SAVE THE GENERATED IMAGE})
await browser.close()
})()
}
PS: I tried to set the path to be the next folder in the flow and it does happen, but Switch still show 0 files in that folder until I deactivate/reactive the flow then it becomes visible.
Thank you in advance.