mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Subtract stream.start
when getting the startXRef
property for documents with a Linearization dictionary (issue 11330)
For documents with a Linearization dictionary the computed `startXRef` position will be relative to the raw file, rather than the actual PDF document itself (which begins with `%PDF-`). Hence it's necessary to subtract `stream.start` in this case, since otherwise the `XRef.readXRef` method will increment the position too far resulting in parsing errors.
This commit is contained in:
parent
f7aafcb218
commit
9199b02a42
3 changed files with 10 additions and 1 deletions
|
@ -453,7 +453,7 @@ class PDFDocument {
|
|||
// Find the end of the first object.
|
||||
stream.reset();
|
||||
if (find(stream, 'endobj', 1024)) {
|
||||
startXRef = stream.pos + 6;
|
||||
startXRef = (stream.pos + 6) - stream.start;
|
||||
}
|
||||
} else {
|
||||
// Find `startxref` by checking backwards from the end of the file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue