How to use puppeteer to generate a PNG file from server side

Answered
Emmanuel asked on December 20, 2023

Hi,
we use Flexmonster in a specific architecture :
1/ Through a web application, users send data, settings... to a Node server
2/ the Node server generate a full HTML content renderering (inclueding scripts call "new Flexmonster(...)"...)
3/ The Node server send the HTML render to the web application that execute the scripts and display the result (the Flex table is a part of the screen of the web application, composed by other charts...)
The Flex license is linked to the URL of the web application. Everything works well.
For a printing requirement, the Node server, after generatig the HTML render, have to be able to generate a PNG file from the full HTML render (and then send either the HTML nor the PNG file to the web application).
We use Puppeteer Node module for the generation of PNG. The HTML content is loaded in the newPage -> page.setContent(html); and a screenshot is done.
The issue is, from server side, when Puppeteer load the HTML content, it try to generate the Flex table but the URL of the Chromium is then "localhost" and doesn't match with the licensed key (URL of the webapplication). The PNG then displays the error license message popup from Flex.
How could we tune Puppeteer to be able to generate the PNG from the rendering HTML directly from server side ?
Regards

1 answer

Public
Maksym Diachenko Maksym Diachenko Flexmonster December 21, 2023

Hello, Emmanuel!

Thank you for reaching out to us.
Could you please send us the screenshot of the license error message? Due to privacy concerns, our customer support team will reach out to you via email. This way, you can send us sensitive license information privately. Also, it would be helpful if you provided the HTML containing Flexmonster alongside the code used for generating a report.
Your cooperation in sharing this information will greatly aid us in resolving this issue. Looking forward to hearing your reply.

Best Regards,
Maksym

Please login or Register to Submit Answer