jspdf的方法addHTML()
和fromHTML()
有什么区别? Documentation只有第一个的信息。
最佳答案
This issue on GitHub没有提到两者之间的具体区别,但确实说它们是具有相似目标的独立插件。
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.
关于javascript - jspdf的方法addHTML()和fromHTML()有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44778260/