-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benefits of pdfcpu optimize #135
Comments
Hello! A PDF file at heart is just a bunch of objects referenced by a cross reference table written to disk.
The main job of Once these (and other) optimization steps are done pdfcpu writes back the cross reference table using 2) utilizing the DEFLATE stream compression filter which is zlib/deflate under the hood. To answer you question: In my case I had to deal with a PDF with a filesize of a couple of gigabytes written by a popular Java PDF library and after optimization and removing embedded fonts it was a lightweight of a couple of hundred megabytes. This was actually my motivation for starting pdfcpu in the first place. So for me it worked out well. Unfortunately pdfcpu does not provide any magic switches but in Let me know if you have further questions. |
Thank you Horst for the quite elaborate and very informative response. The process you describe is in fact an optimization if you will - since the quality of the PDF remains pretty much intact. It's basically a refinement of structure of a given file, which, after clean up, results in a PDF that is unaltered in appearance, with some reduction of file size. Unfortunately, the refinements you mentioned do not always result in dramatic size shifts. The more common tools out there compress images by altering resolution and color, remove hyperlinks, bookmarks etc, and this sort of downsampling will in fact dramatically reduce the PDF file size. However, the caveat here is you will lose quality and the amount of quality loss is certainly proportional to file reduction. I suppose if one is satisfied with content alteration with a large decrease in file size, it's all good! It would be nice to be able to have the ability to compress image resolution and color and I think these two things alone will certainly cut down the size. On a happier note, merging files is certainly stellar in performance, compared to other conventional tools. This really demonstrates the power of go! |
Compressing images on the fly is doable but I think automation is not practical. |
Perhaps a shot in the dark in PDF file compression - since images mainly contribute to the PDF file size, could one extract the images, compress them with any well known library and replace them back into the PDF file? Is this plausible? |
Yes this is conceivable. |
Can I disable PDF optimization? |
Interesting. Please send me this file if you can, optimization should not slow you down. |
Your file has 1 page with an excessive amount of images (>8000). What are you calling? Are you using the CLI or API? For example we could add a |
I’m using both APIs and CLIs and I can't find options to disable optimization |
@ALL - The latest commit features the 🔥 Proceed with caution 🔥 |
The file compression using optimize isn't too significant. Are there some settings I can use to get a better PDF file compression?
The text was updated successfully, but these errors were encountered: