|
|
@ -3,34 +3,34 @@ |
|
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
var Name = (function nameName() { |
|
|
|
var Name = (function NameClosure() { |
|
|
|
function constructor(name) { |
|
|
|
function Name(name) { |
|
|
|
this.name = name; |
|
|
|
this.name = name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor.prototype = { |
|
|
|
Name.prototype = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return constructor; |
|
|
|
return Name; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
var Cmd = (function cmdCmd() { |
|
|
|
var Cmd = (function CmdClosure() { |
|
|
|
function constructor(cmd) { |
|
|
|
function Cmd(cmd) { |
|
|
|
this.cmd = cmd; |
|
|
|
this.cmd = cmd; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor.prototype = { |
|
|
|
Cmd.prototype = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return constructor; |
|
|
|
return Cmd; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
var Dict = (function dictDict() { |
|
|
|
var Dict = (function DictClosure() { |
|
|
|
function constructor() { |
|
|
|
function Dict() { |
|
|
|
this.map = Object.create(null); |
|
|
|
this.map = Object.create(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor.prototype = { |
|
|
|
Dict.prototype = { |
|
|
|
get: function dictGet(key1, key2, key3) { |
|
|
|
get: function dictGet(key1, key2, key3) { |
|
|
|
var value; |
|
|
|
var value; |
|
|
|
if (typeof (value = this.map[key1]) != 'undefined' || key1 in this.map || |
|
|
|
if (typeof (value = this.map[key1]) != 'undefined' || key1 in this.map || |
|
|
@ -60,29 +60,29 @@ var Dict = (function dictDict() { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return constructor; |
|
|
|
return Dict; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
var Ref = (function refRef() { |
|
|
|
var Ref = (function RefClosure() { |
|
|
|
function constructor(num, gen) { |
|
|
|
function Ref(num, gen) { |
|
|
|
this.num = num; |
|
|
|
this.num = num; |
|
|
|
this.gen = gen; |
|
|
|
this.gen = gen; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor.prototype = { |
|
|
|
Ref.prototype = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return constructor; |
|
|
|
return Ref; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
// The reference is identified by number and generation,
|
|
|
|
// The reference is identified by number and generation,
|
|
|
|
// this structure stores only one instance of the reference.
|
|
|
|
// this structure stores only one instance of the reference.
|
|
|
|
var RefSet = (function refSet() { |
|
|
|
var RefSet = (function RefSetClosure() { |
|
|
|
function constructor() { |
|
|
|
function RefSet() { |
|
|
|
this.dict = {}; |
|
|
|
this.dict = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor.prototype = { |
|
|
|
RefSet.prototype = { |
|
|
|
has: function refSetHas(ref) { |
|
|
|
has: function refSetHas(ref) { |
|
|
|
return !!this.dict['R' + ref.num + '.' + ref.gen]; |
|
|
|
return !!this.dict['R' + ref.num + '.' + ref.gen]; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -92,18 +92,18 @@ var RefSet = (function refSet() { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return constructor; |
|
|
|
return RefSet; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
var Catalog = (function catalogCatalog() { |
|
|
|
var Catalog = (function CatalogClosure() { |
|
|
|
function constructor(xref) { |
|
|
|
function Catalog(xref) { |
|
|
|
this.xref = xref; |
|
|
|
this.xref = xref; |
|
|
|
var obj = xref.getCatalogObj(); |
|
|
|
var obj = xref.getCatalogObj(); |
|
|
|
assertWellFormed(isDict(obj), 'catalog object is not a dictionary'); |
|
|
|
assertWellFormed(isDict(obj), 'catalog object is not a dictionary'); |
|
|
|
this.catDict = obj; |
|
|
|
this.catDict = obj; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor.prototype = { |
|
|
|
Catalog.prototype = { |
|
|
|
get toplevelPagesDict() { |
|
|
|
get toplevelPagesDict() { |
|
|
|
var pagesObj = this.catDict.get('Pages'); |
|
|
|
var pagesObj = this.catDict.get('Pages'); |
|
|
|
assertWellFormed(isRef(pagesObj), 'invalid top-level pages reference'); |
|
|
|
assertWellFormed(isRef(pagesObj), 'invalid top-level pages reference'); |
|
|
@ -253,11 +253,11 @@ var Catalog = (function catalogCatalog() { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return constructor; |
|
|
|
return Catalog; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
var XRef = (function xRefXRef() { |
|
|
|
var XRef = (function XRefClosure() { |
|
|
|
function constructor(stream, startXRef, mainXRefEntriesOffset) { |
|
|
|
function XRef(stream, startXRef, mainXRefEntriesOffset) { |
|
|
|
this.stream = stream; |
|
|
|
this.stream = stream; |
|
|
|
this.entries = []; |
|
|
|
this.entries = []; |
|
|
|
this.xrefstms = {}; |
|
|
|
this.xrefstms = {}; |
|
|
@ -278,7 +278,7 @@ var XRef = (function xRefXRef() { |
|
|
|
error('Invalid root reference'); |
|
|
|
error('Invalid root reference'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor.prototype = { |
|
|
|
XRef.prototype = { |
|
|
|
readXRefTable: function readXRefTable(parser) { |
|
|
|
readXRefTable: function readXRefTable(parser) { |
|
|
|
var obj; |
|
|
|
var obj; |
|
|
|
while (true) { |
|
|
|
while (true) { |
|
|
@ -642,7 +642,7 @@ var XRef = (function xRefXRef() { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return constructor; |
|
|
|
return XRef; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -651,7 +651,7 @@ var XRef = (function xRefXRef() { |
|
|
|
* inside of a worker. The `PDFObjects` implements some basic functions to |
|
|
|
* inside of a worker. The `PDFObjects` implements some basic functions to |
|
|
|
* manage these objects. |
|
|
|
* manage these objects. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var PDFObjects = (function pdfObjects() { |
|
|
|
var PDFObjects = (function PDFObjectsClosure() { |
|
|
|
function PDFObjects() { |
|
|
|
function PDFObjects() { |
|
|
|
this.objs = {}; |
|
|
|
this.objs = {}; |
|
|
|
} |
|
|
|
} |
|
|
|