What are the differences between jspdf's methods addHTML()
and fromHTML()
? Documentation only has info for the first one.
This issue on GitHub doesn't mention specific differences between the two but does say that they are separate plugins with similar goals.
Existing jsPDF plugins
Hi, I've been working on a new html2pdf package that uses html2canvas + jsPDF to convert HTML content to PDF. I know there are already three existing jsPDF plugins for HTML:
addHTML
,fromHTML
, andhtml2pdf
(same name). I don't want to step on any toes - from what I can tell:
fromHTML
is the oldest plugin and renders the HTML directly to PDF (which is great), but its support for complex HTML/CSS is lacking.addHTML
is newer (but now deprecated) and uses html2canvas/rasterizeHTML to create a canvas, then puts the image onto the PDF page. Current state is described at #944.html2pdf
: I haven't found much info (apart from the demo), but it looks like it renders directly to PDF like fromHTML, which again is great but runs the risk of poor HTML/CSS support.