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
Open source PDF library for C/C++ application?
提问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
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 库开始,并利用 Adobe免费的在线 PDF 参考对其进行扩充以处理PDF。
回答by Sangcheol Choi
回答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
- LibHaruseems to be used by many.
- LibHaru似乎被很多人使用。
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
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 库一起使用。