PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Error when dict contains hexstring or nested dict + patch
http://forum.pdfsharp.com/viewtopic.php?f=3&t=3449
Page 1 of 1

Author:  Gerben Vos [ Thu Sep 08, 2016 7:39 pm ]
Post subject:  Error when dict contains hexstring or nested dict + patch

PdfSharp does not do a full parse of dictionaries that occur in content streams, but instead just scans for the next '>' character. This fails if the dictionary contains nested dictionaries (delimited by << >>), or hexadecimal strings (delimited by < >).

Depending on the exact syntax in the content stream, this can result in these error messages:
- The given key was not present in the dictionary. (origami.pdf)
- Unexpected character '0x003e' in content stream. (found in confidential client PDFs only, sorry)
- Array within array... (SmoothShading.pdf)

Resolved by implementing a more thorough scanning of the dictionary. It should really be fixed by doing a proper recursive parse instead of a scan, but that would require more drastic changes to the library.

Patch attached.

Attachments:
SmoothShading.zip [138.05 KiB]
Downloaded 202 times
origami.zip [41.39 KiB]
Downloaded 199 times
pdfsharp-687.zip [827 Bytes]
Downloaded 206 times

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/