pdfcpu / pdfcpu

A PDF processor written in Go.

Home Page:http://pdfcpu.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF optimization corrupts certain PDF documents

xelan opened this issue · comments

PDF optimization corrupts certain PDF documents

Please ensure the following:

  • Your issue is based on the latest commit

Tried with 0.7.0, as well as the latest main commit:

$ pdfcpu version
pdfcpu: v0.7.0 dev
commit: 3282d8a7 (2024-03-19T01:17:41Z)
base  : go1.22.1
config: /root/.config/pdfcpu/config.yml
  • State your OS and OS version

Debian 12 x64, Windows 10 22H2 x64

  • When reporting a problem with a specific PDF input file please avoid stating the organization responsible for the PDFWriter - just refer to the PDFWriter
$ pdfcpu optimize --config=disable test03_ol_raw.pdf test03_ol_raw_opt.pdf
writing test03_ol_raw_opt.pdf...
optimizing...

The resulting optimized PDF test03_ol_raw_opt.pdf can still be opened successfully in Chromes built-in PDF viewer and Evince 3.38.2.

However, Adobe Reader 2024.001.20604 x64 on Windows 10 displays an error message "An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem." and shows only a small part of the PDF file.

When opening the corrupted PDF file with Firefox or a standalone PDF.js implementation, no error message is displayed, but it also shows only a small part of the PDF file.

Please note that we could unfortunately not reproduce the issue with synthetic test files. The used real-life example files are restricted, so I'll send them to your GMail address.

Thank you very much, best regards
Andreas

This is fixed with latest commit!
Note: You need to renew your configuration because of the new config flags: Optimize, OptimizeResourceDicts.

Thank you very much 👍