From 2e83b0cc0d682ab2f7d6c7d6388da312c15f5e95 Mon Sep 17 00:00:00 2001 From: sbarman Date: Tue, 5 Jul 2011 11:10:14 -0500 Subject: [PATCH 1/2] Fixes to parser for the test pdf in www.unicode.org/charts --- pdf.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pdf.js b/pdf.js index 5644bf036..c34bc76ed 100644 --- a/pdf.js +++ b/pdf.js @@ -2236,6 +2236,9 @@ var Lexer = (function() { var stream = this.stream; var ch; while (true) { + if (!stream.getChar) + log("bad stream"); + if (!(ch = stream.getChar())) return EOF; if (comment) { @@ -2842,7 +2845,7 @@ var Page = (function() { constructor.prototype = { getPageProp: function(key) { - return this.pageDict.get(key); + return this.xref.fetchIfRef(this.pageDict.get(key)); }, inheritPageProp: function(key) { var dict = this.pageDict; @@ -3579,6 +3582,7 @@ var CanvasGraphics = (function() { }, compile: function(stream, xref, resources, fonts) { + resources = xref.fetchIfRef(resources) || new Dict(); var xobjs = xref.fetchIfRef(resources.get("XObject")) || new Dict(); var parser = new Parser(new Lexer(stream), false); From 28a01646bb40328c29593e0d221e3e9817685c86 Mon Sep 17 00:00:00 2001 From: sbarman Date: Tue, 5 Jul 2011 11:13:53 -0500 Subject: [PATCH 2/2] cleanup --- pdf.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/pdf.js b/pdf.js index c34bc76ed..ea28ca647 100644 --- a/pdf.js +++ b/pdf.js @@ -2236,9 +2236,6 @@ var Lexer = (function() { var stream = this.stream; var ch; while (true) { - if (!stream.getChar) - log("bad stream"); - if (!(ch = stream.getChar())) return EOF; if (comment) {