1👍
Solution 1:
(Can’t add comment, so listing potential solution as answer)
I had similar problem at my work. This is how I solved it:
- Collect each of the charts as sperate images, by converting to base64 and saving them.
- Have a pdf with predefined layout, using pdf parser place these images in predetermined spots.
This way the pdf would always look the same.
Looks, you have data too… you can collect each of them in a json and again write the info using the PDF parser.
Solution 2:
When the user click on ‘Print/Save as PDF:’
- Open same page in a new window with predetermined height/width (in which everything looks alright).
- Trigger Print after this was fully loaded.
This way your pdf will always look the same.
- Chartjs-Adding a custom image to a chartjs bar chart
- Chartjs-Change the font size of chart.js with chartkick
Source:stackexchange.com