Skip to content

Commit e5d91ab

Browse files
committed
Fix invalid arguments error.
1 parent fcc05b0 commit e5d91ab

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/core.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -558,20 +558,9 @@ var PDFDoc = (function pdfDoc() {
558558
var properties = data[4];
559559

560560
if (file) {
561+
// Rewrap the ArrayBuffer in a stream.
561562
var fontFileDict = new Dict();
562-
fontFileDict.map = file.dict.map;
563-
564-
var fontFile = new Stream(file.bytes, file.start,
565-
file.end - file.start, fontFileDict);
566-
567-
// Check if this is a FlateStream. Otherwise just use the created
568-
// Stream one. This makes complex_ttf_font.pdf work.
569-
var cmf = file.bytes[0];
570-
if ((cmf & 0x0f) == 0x08) {
571-
file = new FlateStream(fontFile);
572-
} else {
573-
file = fontFile;
574-
}
563+
file = new Stream(file, 0, file.length, fontFileDict);
575564
}
576565

577566
// For now, resolve the font object here direclty. The real font

src/evaluator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ var PartialEvaluator = (function partialEvaluator() {
155155
font.loadedName = loadedName;
156156

157157
var translated = font.translated;
158+
// Convert the file to an ArrayBuffer which will be turned back into
159+
// a Stream in the main thread.
160+
if (translated.file)
161+
translated.file = translated.file.getBytes();
162+
158163
handler.send('obj', [
159164
loadedName,
160165
'Font',

0 commit comments

Comments
 (0)