qpdf icon indicating copy to clipboard operation
qpdf copied to clipboard

Increase in File Size

Open Hiche3 opened this issue 1 year ago • 1 comments

Occasionally I come across a pdf file where the new file is larger than the original file. Although this recently happened with version 11.9 it has happened with other versions too (10.x branch), different files.

Switch: qpdf.exe --empty --pages Version: qpdf 11.9.0

Any idea what could be causing this?

Hiche3 avatar Mar 27 '24 02:03 Hiche3

There are a number of reasons why pdf files generated by qpdf in the way you describe may be larger than the original files. One of the reasons could be that the objects in the original file are stored in compressed object streams. The way you are using qpdf, qpdf would uncompress the objects and copy them to the new empty file without re-compressing them. You can use the --object-streams=generate option to instruct qpdf to generate compressed object streams in the output file. You can also control the level of compression with the --compression-level option. For more detail see https://qpdf.readthedocs.io/en/stable/cli.html#pdf-transformation

m-holger avatar Apr 08 '24 17:04 m-holger

@Hiche3 , I am moving this to the Q&A section of discussions.

m-holger avatar Jun 15 '24 15:06 m-holger