Combining two PDF files in C ++

In C ++, I create a PDF report with libHaru . I am looking to add two pages from an existing PDF to the end of my report. Is there a free way to do this?

Thanks.

+2
source share
2 answers

Try PoDoFo

http://podofo.sourceforge.net/

You can open both PDFs as PDFMemDocuments with PDFMemDocument.Load( filename ) .

Then find the links to the two pages you want to copy and add to the end of the document using InsertPages or, if necessary, delete all but the last two pages of the original document, then call PDFDocument .

Add and transfer the called document. It is hard to say what would be faster or more stable.

Hope this helps, Troy

+3
source

You can use the Ghostscript pdf2ps utility to convert PDF files to PostScript, add PostScript files, and then convert them back to PDF using ps2pdf .

+4
source

All Articles