Working towards embedded image support
This commit is contained in:
parent
cc17707da6
commit
eca8f6b80b
37
pdf.js
37
pdf.js
@ -4251,12 +4251,33 @@ var PartialEvaluator = (function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ('Form' == type.name) {
|
if ('Form' == type.name) {
|
||||||
args[0].code = this.evaluate(xobj, xref,
|
// console.log("got xobj that is a Form");
|
||||||
xobj.dict.get('Resources'), fonts,
|
args[0].code = this.eval(xobj, xref, xobj.dict.get('Resources'),
|
||||||
images);
|
fonts, images);
|
||||||
}
|
}
|
||||||
if (xobj instanceof JpegStream)
|
if (xobj instanceof JpegStream) {
|
||||||
images.bind(xobj); // monitoring image load
|
images.bind(xobj); // monitoring image load
|
||||||
|
// console.log("got xobj that is a JpegStream");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xobj.dict.get('Subtype').name == "Image") {
|
||||||
|
// Check if we have an image that is not rendered by the platform.
|
||||||
|
// Needs to be rendered ourself.
|
||||||
|
if (!(xobj instanceof JpegStream)) {
|
||||||
|
var image = xobj;
|
||||||
|
var dict = image.dict;
|
||||||
|
var w = dict.get('Width', 'W');
|
||||||
|
var h = dict.get('Height', 'H');
|
||||||
|
|
||||||
|
var inline = false;
|
||||||
|
|
||||||
|
var imageObj = new PDFImage(xref, resources, image, inline);
|
||||||
|
|
||||||
|
console.log("xobj subtype image", w, h, imageObj.imageMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("xobj subtype", xobj.dict.get('Subtype').name);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (cmd == 'Tf') { // eagerly collect all fonts
|
} else if (cmd == 'Tf') { // eagerly collect all fonts
|
||||||
var fontName = args[0].name;
|
var fontName = args[0].name;
|
||||||
@ -4285,6 +4306,14 @@ var PartialEvaluator = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var skips = ["paintXObject"];
|
||||||
|
|
||||||
|
if (skips.indexOf(fn) != -1) {
|
||||||
|
// console.log("skipping", fn);
|
||||||
|
args = [];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
fnArray.push(fn);
|
fnArray.push(fn);
|
||||||
argsArray.push(args);
|
argsArray.push(args);
|
||||||
args = [];
|
args = [];
|
||||||
|
@ -50,6 +50,20 @@ var handler = new MessageHandler("worker", {
|
|||||||
|
|
||||||
// TODO: Handle images here.
|
// TODO: Handle images here.
|
||||||
|
|
||||||
|
console.log("about to send page", pageNum);
|
||||||
|
|
||||||
|
// Make a copy of the fnArray and show all cmds it has.
|
||||||
|
var fnArray = preCompilation.fnArray.slice(0).sort();
|
||||||
|
for (var i = 0; i < fnArray.length; true) {
|
||||||
|
if (fnArray[i] == fnArray[i + 1]) {
|
||||||
|
fnArray.splice(i, 1);
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("cmds", fnArray);
|
||||||
|
|
||||||
|
|
||||||
handler.send("page", {
|
handler.send("page", {
|
||||||
pageNum: pageNum,
|
pageNum: pageNum,
|
||||||
fonts: fontsMin,
|
fonts: fontsMin,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user