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

Handle trailing NULLs after %%EOF #136

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eli-collins
Copy link

I ran into a print printer whose output appends a bunch of NULL characters after the %%EOF marker in it's PDFs. This tweaks PdfReader's EOF detector to ignore those like it does trailing whitespace.

Modified PdfReader's EOF detector to ignore trailing NULLs in addition to whitespace.
@pmaupin
Copy link
Owner

pmaupin commented Jun 11, 2018

Thanks for the patch! I have no problem with stripping trailing nulls, but to avoid any chance of regression, I would prefer not to stop stripping other characters which the current version would strip. Python's definition of whitespace includes vertical tabs and form feeds, so I think the characters to be stripped should include '\x0b\x0c'

@eli-collins
Copy link
Author

Sigh. I'm always forgetting those. I'm glad you caught that!

@soferio
Copy link

soferio commented Jun 25, 2018

We had the same issue with any file printed from Chrome on Windows 10. This will be a great patch. Thanks! (BTW, would it make sense to strip everything after the final %%EOF?)

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

Successfully merging this pull request may close these issues.

3 participants