mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
hand in xref to the parser if needed so we can resolve 'Length' for sub-streams
This commit is contained in:
parent
ed51d65409
commit
92aa46cf81
1 changed files with 8 additions and 4 deletions
12
pdf.js
12
pdf.js
|
@ -1402,9 +1402,10 @@ var Lexer = (function() {
|
|||
})();
|
||||
|
||||
var Parser = (function() {
|
||||
function constructor(lexer, allowStreams) {
|
||||
function constructor(lexer, allowStreams, xref) {
|
||||
this.lexer = lexer;
|
||||
this.allowStreams = allowStreams;
|
||||
this.xref = xref;
|
||||
this.inlineImg = 0;
|
||||
this.refill();
|
||||
}
|
||||
|
@ -1513,8 +1514,11 @@ var Parser = (function() {
|
|||
var pos = stream.pos;
|
||||
|
||||
// get length
|
||||
var length;
|
||||
if (!IsInt(length = dict.get("Length"))) {
|
||||
var length = dict.get("Length");
|
||||
var xref = this.xref;
|
||||
if (xref)
|
||||
length = xref.fetchIfRef(length);
|
||||
if (!IsInt(length)) {
|
||||
error("Bad 'Length' attribute in stream");
|
||||
lenght = 0;
|
||||
}
|
||||
|
@ -1783,7 +1787,7 @@ var XRef = (function() {
|
|||
if (e.gen != gen)
|
||||
throw("inconsistent generation in XRef");
|
||||
var stream = this.stream.makeSubStream(e.offset);
|
||||
var parser = new Parser(new Lexer(stream), true);
|
||||
var parser = new Parser(new Lexer(stream), true, this);
|
||||
var obj1 = parser.getObj();
|
||||
var obj2 = parser.getObj();
|
||||
var obj3 = parser.getObj();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue