diff --git a/crypto.js b/crypto.js index e888d0212..d73408ad6 100644 --- a/crypto.js +++ b/crypto.js @@ -139,9 +139,9 @@ var CipherTransform = (function() { }, decryptString: function(s) { var cipher = new this.stringCipherConstructor(); - var data = string2bytes(s); + var data = stringToBytes(s); data = cipher.encryptBlock(data); - return bytes2string(data); + return bytesToString(data); } }; return constructor; diff --git a/pdf.js b/pdf.js index 5644bf036..a9f0ee935 100644 --- a/pdf.js +++ b/pdf.js @@ -2842,7 +2842,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; @@ -3566,6 +3566,7 @@ var CanvasGraphics = (function() { }, execute: function(code, xref, resources) { + resources = xref.fetchIfRef(resources) || new Dict(); var savedXref = this.xref, savedRes = this.res, savedXobjs = this.xobjs; this.xref = xref; this.res = resources || new Dict(); @@ -3579,6 +3580,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); @@ -4452,7 +4454,7 @@ var ColorSpace = (function() { break; case "Indexed": var base = ColorSpace.parse(cs[1], xref, res); - var hiVal = cs[2]; + var hiVal = cs[2] + 1; var lookup = xref.fetchIfRef(cs[3]); return new IndexedCS(base, hiVal, lookup); case "Lab": diff --git a/test/pdfs/shavian.pdf.link b/test/pdfs/shavian.pdf.link new file mode 100644 index 000000000..42c438644 --- /dev/null +++ b/test/pdfs/shavian.pdf.link @@ -0,0 +1 @@ +http://www.unicode.org/charts/PDF/U10450.pdf \ No newline at end of file diff --git a/test/test_manifest.json b/test/test_manifest.json index 06787925f..4302e1f6e 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -26,6 +26,12 @@ "rounds": 1, "type": "load" }, + { "id": "shavian-load", + "file": "pdfs/shavian.pdf", + "link": true, + "rounds": 1, + "type": "load" + }, { "id": "sizes", "file": "pdfs/sizes.pdf", "rounds": 1,