Chartjs and Puppeteer #9698
-
I have a js file with puppeteer to generate a large report in pdf. Everything works pretty fine except for the canvas. In react file this is the basic logic for chartjs:
If I open url or if I print it (CTRL + P) the images are shown in place of canvas but in puppeteer my pdf has the (broken) canvas with wrong size (even with printing locked as true). This is what I expect and I can see in browser and printing: And this is what I got from puppeteer: Can anybody please help me with this? Thanks in advance. PS: I have this question at StackOverflow: https://stackoverflow.com/questions/69267937/puppeteer-and-pdf-generation-with-canvas PPS: the images are generated but they seem to be created before correct render of canvas |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Might be related to #7006. I would make sure that animations are disabled and see if that helps |
Beta Was this translation helpful? Give feedback.
-
I tried suggested but it didn't work yet. Do you guys have any other idea? Tks... |
Beta Was this translation helpful? Give feedback.
-
You could try a pure JS solution like https://github.com/shellyln/chart.js-node-ssr-example |
Beta Was this translation helpful? Give feedback.
-
I've found a solution seting
|
Beta Was this translation helpful? Give feedback.
I've found a solution seting
page.setViewport()
in puppeteer. This is the final js file: