Skip to content
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

Watermarking fails with: unexpected EOF #713

Closed
tomassommareqt opened this issue Sep 19, 2023 · 5 comments
Closed

Watermarking fails with: unexpected EOF #713

tomassommareqt opened this issue Sep 19, 2023 · 5 comments
Assignees

Comments

@tomassommareqt
Copy link

First, thank you for a great pdf processing library!

There is an issue in pdfcpu.AddWatermarks causing it to fail if the pdf contains a flated content stream containing an EOF which is not uncommon.

After some investigation, this seem to stem from a known "dubious" behaviour in the standard libraries compression/zlib library. See the following go issue on GitHub: golang/go#14675.

This has caused regressions in other standard library packages, e.g. golang/go#14676. This have been fixed by wrapping the io.Reader in a stickyErrorReader. See: https://go-review.googlesource.com/c/go/+/20297.

There are other PDF libraries that deal with the situation where an EOF is contained within a flated content stream. E.g., see the decompress function on line 66 in https://github.com/py-pdf/pypdf/blob/main/pypdf/filters.py.

Do you think a similar way of dealing with possible EOFs in flated content streams can be implemented in pdfcpu?

OS: Mac OS X Ventura 13.5.2

@hhrutter
Copy link
Collaborator

Please share or point me to a test file for analysis and I am on it!

@hhrutter
Copy link
Collaborator

Will be addressed in the next release - see also #722

@hhrutter
Copy link
Collaborator

This should be fixed with https://github.com/pdfcpu/pdfcpu/releases/tag/v0.6.0

@tomassommareqt
Copy link
Author

Thanks for fixing this! And sorry for not being of more assistance.

@hhrutter
Copy link
Collaborator

No problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants