Browse Source

Fix invalid arguments error.

Brendan Dahl 14 years ago
parent
commit
e5d91ab219
  1. 15
      src/core.js
  2. 5
      src/evaluator.js

15
src/core.js

@ -558,20 +558,9 @@ var PDFDoc = (function pdfDoc() {
var properties = data[4]; var properties = data[4];
if (file) { if (file) {
// Rewrap the ArrayBuffer in a stream.
var fontFileDict = new Dict(); var fontFileDict = new Dict();
fontFileDict.map = file.dict.map; file = new Stream(file, 0, file.length, fontFileDict);
var fontFile = new Stream(file.bytes, file.start,
file.end - file.start, fontFileDict);
// Check if this is a FlateStream. Otherwise just use the created
// Stream one. This makes complex_ttf_font.pdf work.
var cmf = file.bytes[0];
if ((cmf & 0x0f) == 0x08) {
file = new FlateStream(fontFile);
} else {
file = fontFile;
}
} }
// For now, resolve the font object here direclty. The real font // For now, resolve the font object here direclty. The real font

5
src/evaluator.js

@ -155,6 +155,11 @@ var PartialEvaluator = (function partialEvaluator() {
font.loadedName = loadedName; font.loadedName = loadedName;
var translated = font.translated; var translated = font.translated;
// Convert the file to an ArrayBuffer which will be turned back into
// a Stream in the main thread.
if (translated.file)
translated.file = translated.file.getBytes();
handler.send('obj', [ handler.send('obj', [
loadedName, loadedName,
'Font', 'Font',

Loading…
Cancel
Save