empira / PDFsharp-1.5

A .NET library for processing PDF
MIT License
1.27k stars 588 forks source link

Allow /Filter value to be a indirect object. #50

Open zobo opened 6 years ago

zobo commented 6 years ago

Cases where the /Filter value is an iref the filter lookup would search for "18 0 R" and fail to process content. This was seen with filter array values in a PDF-1.3.

TH-Soft commented 6 years ago

Code looks good. Can you provide a non-confidential PDF that uses indirect filter objects for testing purposes?

zobo commented 6 years ago

Hi, the ones I've encountered I can sadly not share. I also do not have access to the generator. However the structure is quite interesting.

Here as an example, how the indirect array is used:

17 0 obj
<</Type/XObject/Subtype/Image/Filter 18 0 R/Length 1178/Name/00009/Width 280/Height 161/BitsPerComponent 1/ImageMask true>>stream 
...

However the referenced 18 0 is not available directly in the document, but rather embedded in a /ObjSim as the last non-XRef object.

4 0 obj
<</Length 1196/Filter/FlateDecode/Type/ObjStm/N 25/First 185>>stream 
...

Let me know if I can help you with any other info.