Chartjs-Html2canvas Capture a chart.js-Chart with the size of full screen on different window size

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:

  1. Collect each of the charts as sperate images, by converting to base64 and saving them.
  2. 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:’

  1. Open same page in a new window with predetermined height/width (in which everything looks alright).
  2. Trigger Print after this was fully loaded.

This way your pdf will always look the same.

Leave a comment