How to Print to Canvas?

Open the HTML page containing the canvas

Get the canvas element with JavaScript

Convert the canvas to an image using `toDataURL()` or `toBlob()`

Create a new `Image` object from the canvas data

Open a print window or new tab

Write an HTML document containing the image

Trigger the browser print dialog with `window.print()`

Alternatively, draw the canvas content onto a hidden print canvas

Use CSS print styles to size the canvas for the page

Call `print()` after the image or canvas is fully loaded

Suggested for You

Trending Today