mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Add a recoveryMode
that suppresses errors from the Parser
, and utilize it when searching for the main trailer in XRef_indexObjects
(bug 1250079)
Instead of having `Parser_getObj` fail unconditionally for the referenced PDF file, this patch attempts to let searching for the main trailer continue even if there are errors. Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1250079.
This commit is contained in:
parent
94089960c0
commit
544d29f5cb
5 changed files with 22 additions and 5 deletions
|
@ -970,13 +970,15 @@ var XRef = (function XRefClosure() {
|
|||
var dict;
|
||||
for (i = 0, ii = trailers.length; i < ii; ++i) {
|
||||
stream.pos = trailers[i];
|
||||
var parser = new Parser(new Lexer(stream), true, this);
|
||||
var parser = new Parser(new Lexer(stream), /* allowStreams = */ true,
|
||||
/* xref = */ this, /* recoveryMode = */ true);
|
||||
var obj = parser.getObj();
|
||||
if (!isCmd(obj, 'trailer')) {
|
||||
continue;
|
||||
}
|
||||
// read the trailer dictionary
|
||||
if (!isDict(dict = parser.getObj())) {
|
||||
dict = parser.getObj();
|
||||
if (!isDict(dict)) {
|
||||
continue;
|
||||
}
|
||||
// taking the first one with 'ID'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue