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

标签 javascript jspdf

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/

相关文章:

Javascript Canvas Breakout 碰撞检测问题

javascript - 我需要过滤字符串中的连字符 (-) 和空格 (""),我做错了什么?

javascript - 如何修复 GraphQL Relay 连接的循环依赖

javascript - 如何在从 HTML 生成的 pdf 中添加标题

javascript - 如何在 Chrome 的 PDF 查看器中显示带有名称的 javascript 文件对象?

javascript - "Serve modules without publishing"相当于 RAD 8?

javascript - 使用 jQuery-ajax 将 HTML 加载到 <div>

android - 带有 Cordova 的 jsPDF - 添加图像

pdf - 如何使用 jsPDF 从 SVG 轻松创建 PDF?

javascript - 使用jsPDF和jsPDF autotable创建pdf时出现空行