Problem printing Canvas tag content (Chrome, Opera)

These browsers (versions of Windows) correctly print a web page with a canvas overlay on the image of the img tag:

IE6, IE7, IE8, Firefox, Safari

But Chrome (updated when I type this in version 3.0.195.27) and Opera (updated as this version 10.0 build 1750 enters). Chrome completely ignores canvas rendering. Opera displays the entire canvas as a white rectangle, shading the image behind it.

I know that the canvas tag is quite new, and that printing web pages is always very risky. How should I handle this? Are there any settings that I am missing to make this work? Is there a “print” event that I can catch from JavaScript to alert the user at least?


Update: It's even weirder than it sounds. The composite image (canvas overlaid on img) prints correctly on my Brother laser printer, but not on my inkjet).

So, the current situation is that most browsers print my inkjet correctly, but Chrome does not. Opera clamps on both printers.

Is this all for printer drivers and how do different browsers communicate with them?


Update. I noticed that Google Docs creates PDF for printing. A.

+3
3

PHP PDF PDF. !

PDF :

$pdf = pdf_new();

:

pdf_open_file($pdf, "pdfName.pdf");

, :

pdf_set_info($pdf, "Title", "pdf Title here");

pdf_begin_page():

pdf_begin_page($pdf, 595, 842);

A4.

pdf_end_page($pdf);
pdf_close($pdf);

PHP PDF.

+2

, <canvas>: , canvas CSS <div> background-image "url("+myCanvasObject.toDataUrl()+")".

, src <img /> myCanvasObject.toDataUrl(). , , .

+1

I would suggest saving the page in PDF format and trying to print. The printable PDF must be WYSIWYG. If the PDF rendering is right, any printer should print it in order.

0
source

Source: https://habr.com/ru/post/1720484/


All Articles