<p>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?</p>

<p>I looked at the answers to <a href="https://stackoverflow.com/questions/177/how-do-i-programmatically-create-a-pdf-in-my-net-application">this question</a>, but they mostly relate to .Net.</p>

[{'answer_id': 58737, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 7, 'selected': True, 'text': '<p><a href="https://github.com/libharu/libharu" rel="noreferrer">LibHaru</a></p>\n\n<blockquote>\n  <p>Haru is a free, cross platform,\n  open-sourced software library for\n  generating PDF written in ANSI-C. It\n  can work as both a static-library (.a,\n  .lib) and a shared-library (.so,\n  .dll).</p>\n</blockquote>\n\n<p>Didn\'t try it myself, but maybe it can help you</p>\n'}, {'answer_id': 58747, 'author': 'Tyler', 'author_id': 3561, 'author_profile': 'https://Stackoverflow.com/users/3561', 'pm_score': 4, 'selected': False, 'text': '<p>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 <a href="http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf" rel="noreferrer">free online PDF reference</a>.</p>\n'}, {'answer_id': 58771, 'author': 'prakash', 'author_id': 123, 'author_profile': 'https://Stackoverflow.com/users/123', 'pm_score': 3, 'selected': False, 'text': '<ul>\n<li><a href="http://libharu.org/wiki/Main_Page" rel="nofollow noreferrer">LibHaru</a> seems to be used by many.</li>\n</ul>\n\n<p>A non-open source approach is: <a href="http://www.colorpilot.com/pdflibrary.html" rel="nofollow noreferrer">PDF Creator Pilot</a> which provides more language options  including C++, C#, Delphi, ASP, ASP.NET, VB, VB.NET, VBScript, PHP and Python</p>\n'}, {'answer_id': 58777, 'author': 'Leon Timmermans', 'author_id': 4727, 'author_profile': 'https://Stackoverflow.com/users/4727', 'pm_score': 3, 'selected': False, 'text': '<p>It depends a bit on your needs. Some toolkits are better at drawing, others are better for writing text. <a href="http://en.wikipedia.org/wiki/Cairo_(graphics)" rel="noreferrer">Cairo</a> has 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.</p>\n'}, {'answer_id': 417148, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 4, 'selected': False, 'text': '<p>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:</p>\n\n<p><a href="http://podofo.sourceforge.net/" rel="noreferrer">http://podofo.sourceforge.net/</a></p>\n\n<p>Enjoy!</p>\n'}, {'answer_id': 10571485, 'author': 'Peter', 'author_id': 1123360, 'author_profile': 'https://Stackoverflow.com/users/1123360', 'pm_score': 3, 'selected': False, 'text': '<p>muPdf library looks very promising: <a href="http://mupdf.com/" rel="noreferrer">http://mupdf.com/</a></p>\n\n<p>There is also an open source viewer: <a href="http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html" rel="noreferrer">http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html</a></p>\n'}, {'answer_id': 14131633, 'author': 'Lidia Mirkin', 'author_id': 1944383, 'author_profile': 'https://Stackoverflow.com/users/1944383', 'pm_score': 3, 'selected': False, 'text': '<p>PDF Hummus.\nsee for <a href="http://pdfhummus.com/" rel="noreferrer">http://pdfhummus.com/</a> - contains all required features for manipulation with PDF files except rendering. </p>\n'}, {'answer_id': 14861479, 'author': 'Taran Rampersad', 'author_id': 1991601, 'author_profile': 'https://Stackoverflow.com/users/1991601', 'pm_score': 1, 'selected': False, 'text': '<p><a href="http://wxcode.sourceforge.net/docs/wxpdfdoc/" rel="nofollow">http://wxcode.sourceforge.net/docs/wxpdfdoc/</a></p>\n\n<p>Works with the wxWidgets library.</p>\n'}, {'answer_id': 19559773, 'author': 'Sangcheol Choi', 'author_id': 1073773, 'author_profile': 'https://Stackoverflow.com/users/1073773', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.jagpdf.org" rel="noreferrer">jagpdf</a> seems to be one of them. It is written in C++ but provides a C API.</p>\n'}, {'answer_id': 20173245, 'author': 'M.Hefny', 'author_id': 637718, 'author_profile': 'https://Stackoverflow.com/users/637718', 'pm_score': 2, 'selected': False, 'text': '<p>Try <a href="http://www.cyberciti.biz/open-source/html-to-pdf-freeware-linux-osx-windows-software/" rel="nofollow">wkhtmltopdf</a>  </p>\n\n<p>Software features</p>\n\n<p>Cross platform.\nOpen source.\nConvert any web pages into PDF documents using webkit.\nYou can add headers and footers.\nTOC generation.\nBatch mode conversions.\nCan run on Linux server with an XServer (the X11 client libs must be installed).\nCan be directly used by PHP or Python via bindings to libwkhtmltox.</p>\n'}]
['https://Stackoverflow.com/questions/58730', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3853/']