HTML 转 PDF 的工作原理(特别是 abcPDF)

发布于 2024-12-29 21:37:06 字数 353 浏览 1 评论 0原文

我的新项目是使用 URL 将 HTML 即时转换为 PDF。 我在初期进行了很多搜索,并提出了解决方案,以便 HTML 转换为 IMAGE,IMAGE 转换为 PDF。 但它不是理想的解决方案,因为用户无法从 PDF 文件复制粘贴。

最近我遇到了 abcPDF 组件,你可以在这里查看他们的演示 http://www.abcpdfeditor.com/

现在我想知道他们如何能够生成具有所有这些功能的如此漂亮的 PDF。他们的逻辑会是什么?我不认为他们会解析每个 HTML 标签来创建文档。你们有什么想法吗?

任何帮助将不胜感激

My new project is converting the HTML into PDF on the fly using the URL.
I have searched a lot in my initial period and come up with the solution so that HTML convert to IMAGE and IMAGE goes to PDF.
But its not ideal solution as user can not copy paste from the PDF file.

Recently i came across abcPDF component, you can check their demo here http://www.abcpdfeditor.com/

Now i am wondering how they are able to produce such a nice PDF with all such feature. What will be their logic? I dont think they are going to parse each and every HTML tag to create document. Do you guys have any idea?

Any help will be much appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九八野马 2025-01-05 21:37:06

简而言之,这就是大多数 HTML 到 PDF 转换的工作原理。

HTML ----转换为 ----> EMF(图元文件/矢量图像)----> PDF

  1. 基本上,IE 的渲染引擎(即 MSHTML)有一些 API,通过它们您可以将加载的 HTML 页面导出为 Emf(增强型图元文件格式),它只不过是矢量图像。

您可以利用这个开源 Web 浏览器控件来实现此目的。
http://groups.google.com/group/csexwb

  1. 然后您必须渲染生成的 EMF文件到 PDF 页面。这通常称为 EMF 到 PDF 转换。据我了解,没有免费的 Emf 到 PDF 转换软件可用。但 ITextsharp 对 WMF 格式提供最低限度的支持。

In short, this is how most HTML to PDF conversion works.

HTML ----Converted To ----> EMF (Metafile/Vector Image) ----> PDF

  1. Basically, IE's rendering engine (i.e, MSHTML) has some APIs through which you can export loaded HTML page as Emf (Enhanced metafile format) which is nothing but a vector image.

You can make use of this open-source web browser control for this purpose.
http://groups.google.com/group/csexwb

  1. Then you have to render the generated EMF file on to PDF page. This is typically called as, EMF to PDF conversion. Based on my understanding there is no free Emf to PDF conversion software available. But ITextsharp provides minimal support for WMF format.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文