What are the differences between jspdf addHTML () and fromHTML () methods?

What is the difference between jspdf addHTML()

and methods fromHTML()

? The documentation only contains information for the former.

+3


source to share


1 answer


This issue on GitHub does not mention specific differences between the two, but they say they are separate plugins with similar purposes.

From the problem:



Existing jsPDF plugins

Hi I have been working on a new html2pdf package that uses html2canvas + jsPDF to convert HTML content to PDF. I know that for HTML already, there are three existing jsPDF-plugin: addHTML

, fromHTML

and html2pdf

(the same name). I don't want to step on any fingers - from what I can tell:

  • fromHTML

    is the oldest plugin and renders HTML directly to PDF (which is great), but it lacks support for complex HTML / CSS.
  • addHTML

    is newer (but now deprecated) and uses html2canvas / rasterizeHTML to create a canvas and then puts the image on the PDF page. The current state is described in # 944 .
  • html2pdf

    : I didn't find much info (other than the demo ) but it looks like it displays directly to PDF as from HTML, which is great again, but risks poor HTML / CSS support.
+1


source







All Articles