return null;
};
- ColorSpace.parseToIR = function colorSpaceParseToIR(cs, xref, res) {
+ ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
if (isName(cs)) {
- var colorSpaces = xref.fetchIfRef(res.get('ColorSpace'));
+ var colorSpaces = res.get('ColorSpace');
if (isDict(colorSpaces)) {
var refcs = colorSpaces.get(cs.name);
if (refcs)
}
Page.prototype = {
- getPageProp: function pageGetPageProp(key) {
+ getPageProp: function Page_getPageProp(key) {
- return this.xref.fetchIfRef(this.pageDict.get(key));
+ return this.pageDict.get(key);
},
- inheritPageProp: function pageInheritPageProp(key) {
+ inheritPageProp: function Page_inheritPageProp(key) {
var dict = this.pageDict;
var obj = dict.get(key);
while (obj === undefined) {
// shadow the prototype getter
return shadow(this, 'numPages', num);
},
- getDocumentInfo: function pdfDocGetDocumentInfo() {
+ getDocumentInfo: function PDFDocModel_getDocumentInfo() {
var info;
if (this.xref.trailer.has('Info'))
- info = this.xref.fetch(this.xref.trailer.get('Info'));
+ info = this.xref.trailer.get('Info');
return shadow(this, 'getDocumentInfo', info);
},
properties.hasEncoding = hasEncoding;
},
- readToUnicode:
- function partialEvaluatorReadToUnicode(toUnicode, xref) {
+ readToUnicode: function PartialEvaluator_readToUnicode(toUnicode, xref) {
- var cmapObj = xref.fetchIfRef(toUnicode);
+ var cmapObj = toUnicode;
var charToUnicode = [];
if (isName(cmapObj)) {
var isIdentityMap = cmapObj.name.substr(0, 9) == 'Identity-';
}
Dict.prototype = {
- get: function dictGet(key1, key2, key3) {
+ // automatically dereferences Ref objects
+ get: function Dict_get(key1, key2, key3) {
var value;
+ var xref = this.xref;
if (typeof (value = this.map[key1]) != 'undefined' || key1 in this.map ||
typeof key2 == 'undefined') {
- return value;
+ return xref ? this.xref.fetchIfRef(value) : value;
}
if (typeof (value = this.map[key2]) != 'undefined' || key2 in this.map ||
typeof key3 == 'undefined') {
- return value;
+ return xref ? this.xref.fetchIfRef(value) : value;
}
-
- return this.map[key3] || null;
+ value = this.map[key3] || null;
+ return xref ? this.xref.fetchIfRef(value) : value;
+ },
+ // no dereferencing
- getRaw: function dictGetRaw(key) {
++ getRaw: function Dict_getRaw(key) {
+ return this.map[key];
+ },
+ // creates new map and dereferences all Refs
- getAll: function dictGetAll() {
++ getAll: function Dict_getAll() {
+ var all = {};
+ for (var key in this.map)
+ all[key] = this.get(key);
+ return all;
},
- set: function dictSet(key, value) {
+ set: function Dict_set(key, value) {
this.map[key] = value;
},
return key in this.map;
},
- forEach: function dictForEach(callback) {
+ forEach: function Dict_forEach(callback) {
for (var key in this.map) {
- callback(key, this.map[key]);
+ callback(key, this.get(key));
}
}
};
return obj;
return this.fetch(obj);
},
- fetch: function xRefFetch(ref, suppressEncryption) {
+ fetch: function XRef_fetch(ref, suppressEncryption) {
+ assertWellFormed(isRef(ref), 'ref object is not a reference');
var num = ref.num;
if (num in this.cache)
return this.cache[num];
}
return e;
},
- getCatalogObj: function xRefGetCatalogObj() {
- return this.root;
+ getCatalogObj: function XRef_getCatalogObj() {
- return this.fetch(this.root);
++ return this.this.root;
}
};