html5 canvas converted to PDF?

177 views
Skip to first unread message

Marc Maxson

unread,
May 5, 2014, 9:44:11 AM5/5/14
to xhtm...@googlegroups.com
Is there a python module (this or otherwise) that has code for converting an HTML5 canvas on a webpage into an image for embedding into a PDF?

Jonas Grümann

unread,
Jul 3, 2014, 5:06:33 AM7/3/14
to xhtm...@googlegroups.com
Why would you use a python module? If you have an html canvas use javascript's canvas.toDataURL(); to get the image as data-url

Roberto Maurizzi

unread,
Jul 3, 2014, 5:06:59 PM7/3/14
to xhtm...@googlegroups.com
What is you exact use-case?
If you need a python module on your server, well, there the <canvas> will not contain any image. It's the client that renders it.
You'll have to write JS to send back to the server the canvas.toDataURL() as Jonas Grümann said, or eventually you'll have to run a web browser on the server (there are webkit based 'headless' browsers that can output to pdf or png, and then serve that (but this is going to get ugly fast IMHO...)


--
You received this message because you are subscribed to the Google Groups "Pisa XHTML2PDF Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xhtml2pdf+...@googlegroups.com.
To post to this group, send email to xhtm...@googlegroups.com.
Visit this group at http://groups.google.com/group/xhtml2pdf.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages