gpt4 book ai didi

javascript - jspdf的方法addHTML()和fromHTML()有什么区别?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:55:35 25 4
gpt4 key购买 nike

jspdf的方法addHTML()fromHTML()有什么区别? Documentation只有第一个的信息。

最佳答案

This issue on GitHub没有提到两者之间的具体区别,但确实说它们是具有相似目标的独立插件。

From the issue:

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, and html2pdf (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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com