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 -sPAPERSIZE=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?