PDF name tree limits

453 views Asked by At

I have a PDF file that I try to parse using PDF Renderer and have the following issues:

(1) Some of the name trees have Limits defined with either the lower or upper bound is NULL. The specification doesn't really say anything on how to deal with those:

(Intermediate and leaf nodes only; required) An array of two strings, specifying
the (lexically) least and greatest keys included in the Names array of a leaf 
node or in the Names arrays of any leaf nodes that are descendants of an
intermediate node. 

So I am basically assuming an open range if any of the bounds is null, if both limits are null, I'll try to find the key in the names. Is this assumption correct?

(2) In the same PDF file when making the assumption from (1), even though the key I am looking for would fit in the range defined by the limits, the key is not present but have to look at following kids. I guess this is still correct?

(3) Finally, and still in the same PDF file, there are Names that don't follow the

key1 value1 key2 value2 ... keyn valuen

sequence defined in the specification but start with a value:

value0 key1 value1 ... keyn valuen

and ends with a value. So in this case, I just skip the first value at the risk of having the mapping wrong. Again, correct?

My guess is that:

  • either the PDF is not well formed
  • either it uses some 1.6 functionality that totally confuses the library and leads to the symptoms listed above

I would like to make changes to the library to handle the PDF file in question, without breaking the existing code.

Update: to correct this issue, I finally decided to not deal with all the above but address the issue somewhere else. The problem originally came when reading an action in the outline. Now the presumably "faulty" action will simply be ignored. This is the corresponding patch.

0

There are 0 answers