Print-out of a html5 canvas?

前端 未结 2 1845
-上瘾入骨i
-上瘾入骨i 2020-12-06 11:39

I have created a simple html-based web-page consisting of a form and some text, plus a canvas. I would like to print the page including the canvas on a piece of paper, the p

相关标签:
2条回答
  • 2020-12-06 12:43

    You need to use the .toDataURL() method to convert the canvas to an image, which you could place on top of the canvas itself for example, prior to printing. Maybe make a print button on the page, which does that stuff, then prints etc...

    0 讨论(0)
  • 2020-12-06 12:45

    what you need to do in this case is, have a special print view, where the canvas gets replaced by an image file, which then can be printed out easily.

    have a look here: Capture HTML Canvas as gif/jpg/png/pdf?

    0 讨论(0)
提交回复
热议问题