colemana / PyPDF2

A utility to read and write pdfs with Python. Superseded: see https://github.com/knowah/PyPDF2
Other
83 stars 19 forks source link

Resiliance modification #8

Closed Kelketek closed 10 years ago

Kelketek commented 10 years ago

While the PDF spec may not be clear on what to do when there are multiple definitions for the dictionary, the principle of 'strict in what you send, tolerant in what you receive' applies here. I've made a tweak to accept only the first definition, and ignore subsequent ones.

To be honest, I'm not entirely sure what this dictionary is for, and I got the basic idea for this fix based on information from some reported Launchpad bug. What I do know is that the majority of people looking to edit a PDF probably aren't concerned about the dictionary enough to abort loading it at all if it fails to validate perfectly. :)

FedEx is an offender here-- pulling the labels from their API gives me this error, and I don't think I'll be able to convince them to change their PDF format, so I figured I might have a better chance with you folks. :)

Kelketek commented 10 years ago

This ended up managed by some other pull request ages ago.