冠军

导航

在 .NET 下使用 Pdfium 渲染和打印 PDF

在 .NET 下使用 Pdfium 渲染和打印 PDF

大家可能已经看到这条 新闻,Google最近又新推出一个开源项目,名叫 PDFium,将成为Chrome浏览器的PDF渲染引擎组件。与已有的开源PDF引擎如Firefox目前的PDF解决方案PDF.js以及 Poppler相比,PDFium性能要好得多。

本次开源是由Google方面主导的,因为Chrome里的PDF渲染使用的是福昕的专有技术授权,Google方面希望能够开源并提出了很好的条件。福昕从长远考虑,接受了Google的建议。

接下来,福昕仍然会继续投入技术力量支持PDFium的发展。我们已经在PDFium项目网站上看到Bo Xu等三名福昕工程师在 解决和解答各种问题。

官方的 API 文档:https://developers.foxitsoftware.com/resources/pdf-sdk/c_api_reference_pdfium/index.html
一个 PDF 版本的 Pdfium API 文档:http://cdn01.foxitsoftware.com/pub/foxit/manual/enu/FoxitPDF_SDK20_Guide.pdf

许可协议:Apache 2.0 见:https://pdfium.googlesource.com/pdfium/+/refs/heads/master/LICENSE

来源:https://www.csdn.net/article/2014-06-23/2820351-Why-Foxit-Open-Sourced-Core-PDF-technologies

Pdfium 库

Pdfium 本身是一个 C 语言库,编译之后是一个 DLL。

Google 下载
https://pdfium.googlesource.com/pdfium/

GitHub
https://github.com/chromium/pdfium

下载 Pdfium 二进制预编译库

可以直接使用预编译的库,既可以直接从 NuGet 中导入,也可以自己下载使用。

NuGet

下面这两个比较版本比较老。
https://www.nuget.org/packages/PdfiumViewer.Native.x86_64.no_v8-no_xfa/
Native 64-bit PDFium DLL without V8 or XFA support for usage with the PdfiumViewer project.
2018.4.8.256

https://www.nuget.org/packages/PdfiumViewer.Native.x86.no_v8-no_xfa/
Native 32-bit PDFium DLL without V8 or XFA support for usage with the PdfiumViewer project.
2018.4.8.256

GitHub

这个比较新
GitHub: https://github.com/bblanchon/pdfium-binaries

PdfiumViewer

由于 Pdfium 本身并不是 .NET 库,在 .NET 中使用时,需要进行适配,PdfiumViewer 对它进行了适配工作,可以使我们很方便地在 .NET 项目中使用它。

Introduction
PdfiumViewer is a PDF viewer based on the PDFium project.

  • PdfiumViewer provides a number of components to work with PDF files:
  • PdfDocument is the base class used to render PDF documents;
  • PdfRenderer is a WinForms control that can render a PdfDocument;

PdfiumViewer 提供了一个 WinForms 控件,通过 PdfRenderer 控件进行渲染,提供了工具栏,可以支持保存到 PDF 文件或者打印到打印机。
PdfiumViewer is a WinForms control that hosts a PdfRenderer control and adds a toolbar to save the PDF file or print it.

项目:https://github.com/pvginkel/PdfiumViewer

NuGet: https://www.nuget.org/packages/PdfiumViewer/

参考

posted on 2021-01-30 06:47  冠军  阅读(4209)  评论(0编辑  收藏  举报