C/C++ 应用程序的开源 PDF 库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/58730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 12:31:56  来源:igfitidea点击:

Open source PDF library for C/C++ application?

c++cpdfopen-source

提问by ChrisN

I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this?

我希望能够从我的(本机)C++ Windows 应用程序生成 PDF 输出。是否有任何免费/开源库可用于执行此操作?

I looked at the answers to this question, but they mostly relate to .Net.

我查看了这个问题的答案,但它们大多与 .Net 相关。

采纳答案by aku

LibHaru

自由哈鲁

Haru is a free, cross platform, open-sourced software library for generating PDF written in ANSI-C. It can work as both a static-library (.a, .lib) and a shared-library (.so, .dll).

Haru 是一个免费的、跨平台的、开源的软件库,用于生成用 ANSI-C 编写的 PDF。它可以作为静态库(.a、.lib)和共享库(.so、.dll)工作。

Didn't try it myself, but maybe it can help you

自己没试过,但也许可以帮到你

回答by aku

I worked on a project that required a pdf report. After searching for online I found the PoDoFo library. Seemed very robust. I did not need all the features, so I created a wrapper to abstract away some of the complexity. Wasn't too difficult. You can find the library here:

我参与了一个需要 pdf 报告的项目。在网上搜索后,我找到了 PoDoFo 库。看起来非常健壮。我不需要所有的功能,所以我创建了一个包装器来抽象掉一些复杂性。不是太难。你可以在这里找到图书馆:

http://podofo.sourceforge.net/

http://podofo.sourceforge.net/

Enjoy!

享受!

回答by Tyler

If you're brave and willing to roll your own, you could start with a PostScript library and augment it to deal with PDF, taking advantage of Adobe's free online PDF reference.

如果您勇敢并愿意自己动手​​,您可以从 PostScript 库开始,并利用 Adob​​e免费的在线 PDF 参考对其进行扩充以处理PDF

回答by Sangcheol Choi

jagpdfseems to be one of them. It is written in C++ but provides a C API.

jagpdf似乎是其中之一。它是用 C++ 编写的,但提供了一个 C API。

回答by Leon Timmermans

It depends a bit on your needs. Some toolkits are better at drawing, others are better for writing text. Cairohas a pretty good for drawing (it support a wide range of screen and file types, including pdf), but it may not be ideal for good typography.

这有点取决于您的需求。一些工具包更擅长绘图,其他工具包更适合书写文本。Cairo非常适合绘图(它支持广泛的屏幕和文件类型,包括 pdf),但它可能不适合良好的排版。

回答by Lidia Mirkin

PDF Hummus. see for http://pdfhummus.com/- contains all required features for manipulation with PDF files except rendering.

PDF 鹰嘴豆泥。参见http://pdfhummus.com/- 包含除渲染之外的 PDF 文件操作所需的所有功能。

回答by Peter

muPdf library looks very promising: http://mupdf.com/

muPdf 库看起来很有前途:http://mupdf.com/

There is also an open source viewer: http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html

还有一个开源查看器:http: //blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html

回答by prakash

A non-open source approach is: PDF Creator Pilotwhich provides more language options including C++, C#, Delphi, ASP, ASP.NET, VB, VB.NET, VBScript, PHP and Python

一种非开源方法是:PDF Creator Pilot,它提供了更多的语言选项,包括 C++、C#、Delphi、ASP、ASP.NET、VB、VB.NET、VBScript、PHP 和 Python

回答by M.Hefny

Try wkhtmltopdf

试试wkhtmltopdf

Software features

软件特点

Cross platform. Open source. Convert any web pages into PDF documents using webkit. You can add headers and footers. TOC generation. Batch mode conversions. Can run on Linux server with an XServer (the X11 client libs must be installed). Can be directly used by PHP or Python via bindings to libwkhtmltox.

跨平台。开源。使用 webkit 将任何网页转换为 PDF 文档。您可以添加页眉和页脚。TOC 生成。批处理模式转换。可以在带有 XServer 的 Linux 服务器上运行(必须安装 X11 客户端库)。PHP 或 Python 可以通过绑定到 libwkhtmltox 直接使用。

回答by Taran Rampersad

http://wxcode.sourceforge.net/docs/wxpdfdoc/

http://wxcode.sourceforge.net/docs/wxpdfdoc/

Works with the wxWidgets library.

与 wxWidgets 库一起使用。