Merge files into a single PDF using PHP/linux
I'm investigating how one can combine multiple PDF's into a single PDF.
I'm looking for a library that is as reliable and robust as possible. Preferable a library that can preserve bookmarks.
Ghostscript can concat where the bookmarks are preserved, but I experienced trouble where it in one case failed to generate any output.pdf.
gs -q -sPAPERS开发者_如何学CIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf document1.pdf document2.pdf document3.pdf
GPL Ghostscript 8.54: Unrecoverable error, exit code 1
GPL Ghostscript 8.54: ERROR: A pdfmark destination page 36 points beyond the last page 1.
The same documents could I successfully merge with FPDI + TCPDF, however bookmarks wasn't preserved.
I'm worried choosing a solution that cannot merge some PDFs. What good/bad libraries do you have experience with?
I have used pdftk to merge multiple PDF files, and I liked it a lot as it is simple to use. However, I am not sure if it preserves bookmarks, sorry. Could find out at a glance on the home page. If anyone knows, let me know.
I have had good experiences with PDFsam. However, I did not pay attention to bookmark preservation, so you'd have to test it for yourself.
精彩评论