error('bad XRef entry');
}
if (this.encrypt && !suppressEncryption) {
- e = parser.getObj(this.encrypt.createCipherTransform(num, gen));
+ try {
+ e = parser.getObj(this.encrypt.createCipherTransform(num, gen));
+ } catch(ex) {
+ // almost all streams must to encrypted, but sometimes
+ // they are not probably due to some broken generators
+ // re-trying without encryption
+ return this.fetch(ref, true);
+ }
} else {
e = parser.getObj();
}
if (type == 'TrueType' && dict.has('ToUnicode') && differences) {
var cmapObj = dict.get('ToUnicode');
if (IsRef(cmapObj)) {
- cmapObj = xref.fetch(cmapObj, true);
+ cmapObj = xref.fetch(cmapObj);
}
if (IsName(cmapObj)) {
error('ToUnicode file cmap translation not implemented');