Subject: | Can’t handle newlines in references |
In PDF syntax, an indirect reference consists of three distinct tokens that can be separated by any PDF whitespace, and even comments. For example, this is a syntactically valid indirect reference:
1 %eieio
0
R
PDF::API2 does not allow comments at all (based on reading the code; that is not a problem for my PDFs). But it does choke on newlines if the object is long enough that it has not all been read into the file yet.
This happens with:
1895 0
obj<</Count
253/Kids[1896
0
R
1
0
R
7
0
R
13
0
R
...
etc., with 253 entries.
PDF::API2::Basic::PDF::File::readval needs to read more data if it finds what could be a partial reference.