mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
If readXRefStream or readXRefTable fails, fallback to object indexing (#828)
This commit is contained in:
parent
c0291e9fa3
commit
0f7f80ee6e
1 changed files with 17 additions and 12 deletions
|
@ -518,6 +518,7 @@ var XRef = (function xRefXRef() {
|
||||||
readXRef: function readXref(startXRef) {
|
readXRef: function readXref(startXRef) {
|
||||||
var stream = this.stream;
|
var stream = this.stream;
|
||||||
stream.pos = startXRef;
|
stream.pos = startXRef;
|
||||||
|
try {
|
||||||
var parser = new Parser(new Lexer(stream), true);
|
var parser = new Parser(new Lexer(stream), true);
|
||||||
var obj = parser.getObj();
|
var obj = parser.getObj();
|
||||||
// parse an old-style xref table
|
// parse an old-style xref table
|
||||||
|
@ -532,6 +533,10 @@ var XRef = (function xRefXRef() {
|
||||||
}
|
}
|
||||||
return this.readXRefStream(obj);
|
return this.readXRefStream(obj);
|
||||||
}
|
}
|
||||||
|
} catch(e) {
|
||||||
|
log('Reading of the xref table/stream failed: ' + e);
|
||||||
|
}
|
||||||
|
warn('Indexing all PDF objects');
|
||||||
return this.indexObjects();
|
return this.indexObjects();
|
||||||
},
|
},
|
||||||
getEntry: function xRefGetEntry(i) {
|
getEntry: function xRefGetEntry(i) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue