Disable encryption when a ToUnicode stream is used in a font

This commit is contained in:
notmasteryet 2011-09-13 19:23:49 -05:00
parent 3ea4e25fb3
commit 94da20d776
3 changed files with 13 additions and 3 deletions

9
pdf.js
View File

@ -3185,7 +3185,7 @@ var XRef = (function() {
return obj; return obj;
return this.fetch(obj); return this.fetch(obj);
}, },
fetch: function(ref) { fetch: function(ref, suppressEncryption) {
var num = ref.num; var num = ref.num;
var e = this.cache[num]; var e = this.cache[num];
if (e) if (e)
@ -3216,7 +3216,7 @@ var XRef = (function() {
} }
error('bad XRef entry'); error('bad XRef entry');
} }
if (this.encrypt) { if (this.encrypt && !suppressEncryption) {
e = parser.getObj(this.encrypt.createCipherTransform(num, gen)); e = parser.getObj(this.encrypt.createCipherTransform(num, gen));
} else { } else {
e = parser.getObj(); e = parser.getObj();
@ -4356,7 +4356,10 @@ var PartialEvaluator = (function() {
} }
if (type == 'TrueType' && dict.has('ToUnicode') && differences) { if (type == 'TrueType' && dict.has('ToUnicode') && differences) {
var cmapObj = xref.fetchIfRef(dict.get('ToUnicode')); var cmapObj = dict.get('ToUnicode');
if (IsRef(cmapObj)) {
cmapObj = xref.fetch(cmapObj, true);
}
if (IsName(cmapObj)) { if (IsName(cmapObj)) {
error('ToUnicode file cmap translation not implemented'); error('ToUnicode file cmap translation not implemented');
} else if (IsStream(cmapObj)) { } else if (IsStream(cmapObj)) {

View File

@ -0,0 +1 @@
http://www.puppetpress.com/classics/ArtofWarbySunTzu.pdf

View File

@ -109,5 +109,11 @@
"link": true, "link": true,
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
},
{ "id": "artofwar",
"file": "pdfs/artofwar.pdf",
"link": true,
"rounds": 1,
"type": "eq"
} }
] ]