From 9f995645e5d6de4ae9d917b696c1efd21fee38c9 Mon Sep 17 00:00:00 2001 From: sbarman Date: Tue, 21 Jun 2011 10:49:02 -0700 Subject: [PATCH] minor fix to render page, add F command, added inhertable dictionary entries --- pdf.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pdf.js b/pdf.js index fda5b512e..21a131bfd 100644 --- a/pdf.js +++ b/pdf.js @@ -784,6 +784,16 @@ var Dict = (function() { get2: function(key1, key2) { return this.get(key1) || this.get(key2); }, + getOrInherit: function(key, xref) { + var obj = this.map[key]; + var dict = this; + while (!obj && dict) { + dict = xref.fetchIfRef(dict.get("Parent")); + if (dict) + obj = dict.get(key); + } + return obj; + }, has: function(key) { return key in this.map; }, @@ -1701,10 +1711,11 @@ var Page = (function() { return shadow(this, "content", this.pageDict.get("Contents")); }, get resources() { - return shadow(this, "resources", this.pageDict.get("Resources")); + return shadow(this, "resources", + this.pageDict.getOrInherit("Resources", this.xref)); }, get mediaBox() { - var obj = this.pageDict.get("MediaBox"); + var obj = this.pageDict.getOrInherit("MediaBox", this.xref); return shadow(this, "mediaBox", ((IsArray(obj) && obj.length == 4) ? obj : null)); @@ -2154,6 +2165,7 @@ var CanvasGraphics = (function() { S: "stroke", s: "closeStroke", f: "fill", + F: "fill", "f*": "eoFill", B: "fillStroke", "B*": "eoFillStroke",