Patch for dealing with badly formed pdfs made on an ipad#73
Conversation
While reading a pdf annotated on an iPad, the dictionary was created with a String "Name" and not a token.Name. If we accept a String as a valid name, the reader can continue. Makes me think that there should be a way of continuing if an err occurs.
|
Thank you for the PR @comqdhb ! I'm afraid, we think that this change makes the parsing too lenient and can also have many unexpected and undesirable side effects. This change allows basically any key to be a string (still parsing it as if it was a name), and this alters the behavior for parsing any dictionary within any PDF file. There are a lot of sharp edges here:
We've also checked how other PDF processors handle such invalid PDF files and we see that strict approach is commonly applied. If this scenario is critical, we suggest to customize implementation in the client code instead. Dictionary structure check is done in I'm also attaching some of the examples of such invalid documents that we've generated just to keep them here. |
While reading a pdf annotated on an iPad, the dictionary was created with a String "Name" and not a token.Name. If we accept a String as a valid name, the reader can continue.
Makes me think that there should be a way of continuing if an err occurs.