How can Adobe Acrobat do a such a good job at merging PDF files?

Viewed 39

In my work I often find myself at bulk merging multiple A4 event tickets PDF. For the next example I want to bulk merge 500 pdfs of 2Mb each.

The issue is that no matter what tool I use (PDFtk, GhostScript, PDFSam,..) the resulting PDF is of approximately 1Gb. If I do the same job with Acrobat Pro (trial version) the output is of 8Mb without any loss of quality what so ever.

How can Acrobat do such a great job? And how can I replicate this behaviour? Does that have anything to do with the fact that the pdfs are all in the same layout with the same images and the only variables are texts? (seat and row deatails, etc)

I would like to be able to do it in a Linux environment with opensource tools, I even tried to build a Python script to do that using PyPDF2 library but apart from the big size I also lose some text details getting replaced by blank squares.

I've been on this for a couple of days now, does anyone have any idea on how to replicate the Acrobat work?

Thanks in advance

1 Answers

By spotting duplication of common structures (images, fonts) etc. Especially if your 500 files come from a common source, as you suggest they do.

Try...

cpdf in1.pdf in2.pdf in3.pdf etc... -o out.pdf

If the result is still large, you can explicitly do:

cpdf -squeeze out.pdf -o small.pdf

(Cpdf is free for non-commercial use, but only its core, CamlPDF, is fully open source.)

Related