0

There are countless questions and answers that present different solutions to merge 2 or more PDF files and how to extract specific pages and create a PDF with this subset.

Unfortunately I could not find a way (either using a library or command line tools, since it will be scripted) to merge files, such that the resulting file is a valid PDF and later "split back" this file in separate files, using the same page ranges, to obtain the exact same original files (at the binary level).

Is this possible?

devnull
  • 107
  • 6
  • 2
    You can attach the original files as attachments. That would allow you to get them back in their original Form. – mkl Apr 13 '22 at 14:49

1 Answers1

1

Once you merged the PDF files you cannot split the result and obtain the exact same original files at binary level. Source PDF files are not included as opaque binaries blocks in the merged file.

One possible solution solution, as @mkl said, is to use a PDF portfolio to embed the source files as they are. When viewing the portfolio you will see each file as it is, not as a long merged PDF file.

iPDFdev
  • 5,229
  • 2
  • 17
  • 18
  • Thank you and @mlk for the tips. Using the new search terms, so far I've found pdfattach/pdfdetach from the poppler-utils which get very close and I'll probably manage to adapt my needs to their features. I'm also surprised by how well some older/simpler viewers I tested handled such "portfolios" (by showing the first or base file). – devnull Apr 13 '22 at 15:39