1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Separate page objects/images from the fonts; does not store large images

This commit is contained in:
Yury Delendik 2012-10-28 15:10:34 -05:00
parent d2c1868497
commit 69b72078c0
7 changed files with 97 additions and 73 deletions

View file

@ -754,8 +754,6 @@ var PDFObjects = (function PDFObjectsClosure() {
}
PDFObjects.prototype = {
objs: null,
/**
* Internal function.
* Ensures there is an object defined for `objId`. Stores `data` on the
@ -832,6 +830,18 @@ var PDFObjects = (function PDFObjectsClosure() {
}
},
/**
* Returns the data of `objId` if object exists, null otherwise.
*/
getData: function PDFObjects_getData(objId) {
var objs = this.objs;
if (!objs[objId] || !objs[objId].hasData) {
return null;
} else {
return objs[objId].data;
}
},
/**
* Sets the data of an object but *doesn't* resolve it.
*/
@ -839,6 +849,10 @@ var PDFObjects = (function PDFObjectsClosure() {
// Watchout! If you call `this.ensureObj(objId, data)` you're going to
// create a *resolved* promise which shouldn't be the case!
this.ensureObj(objId).data = data;
},
clear: function PDFObjects_clear() {
this.objs = {};
}
};
return PDFObjects;