I have a Chart.js javascript chart ( https://www.chartjs.org/ ) placed on my web page.
This javascript based chart sits inside a Canvas element which has ID: chart-0
<canvas id="chart-0" height="380px"></canvas>
This canvas element is put inside a absolute div element with ID "Chart0" which has been put inside a parent/relative div element with ID "PrintArea".
When users click the "Print" button, javascript code which I wrote prints out the the div element "PrintArea" and its contents.
I was using the javascript function:
window.print();
to print the "PrintArea" div element containing the canvas element "chart-0" because this way, it could print out the Chart.js javascript chart as well as all other html contents inside the "PrintArea" div.
This web page was working fine, it was printing out the part of the web page ("PrintArea" div) without any problem for the last 4 years.
But recently, when users click the print button, the web browser is printing out the "PrintArea" div contents AS WELL AS printing out 715 blank web pages after it. This happens with both Chrome and Edge browsers.
I can see, the problem IS caused by the Chart.js canvas element because if I remove this Chart.js canvas element - "chart-0" from the web page, then the web browser only prints out the contents of the "PrintArea" without any errors.
So,... how do I fix this error? It looks like any webpages that I've created which contain Chart.js are now causing this sort of problem - printing out hundreds of blank pages, whether I use the web browser's default printing menu or javascript printing function.
Please help.
UPDATE: Jonathan's answer shown below solved the problem! Thank you,