Browse Source

PDF.js version 1.4.179 - See mozilla/pdf.js@8910cea7d66dcb160456886bbd6592817997619a

master v1.4.179
Pdf Bot 9 years ago
parent
commit
62ee8d8d3d
  1. 2
      bower.json
  2. 144
      build/pdf.combined.js
  3. 4
      build/pdf.js
  4. 144
      build/pdf.worker.js
  5. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.4.176",
"version": "1.4.179",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

144
build/pdf.combined.js

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {})); @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {}));
// Use strict in our context only - users might not want it
'use strict';
var pdfjsVersion = '1.4.176';
var pdfjsBuild = '447c48e';
var pdfjsVersion = '1.4.179';
var pdfjsBuild = '8910cea';
var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ?
@ -29398,6 +29398,7 @@ var shadow = sharedUtil.shadow; @@ -29398,6 +29398,7 @@ var shadow = sharedUtil.shadow;
var stringToBytes = sharedUtil.stringToBytes;
var string32 = sharedUtil.string32;
var warn = sharedUtil.warn;
var MissingDataException = sharedUtil.MissingDataException;
var Stream = coreStream.Stream;
var Lexer = coreParser.Lexer;
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
@ -32981,8 +32982,123 @@ var CFFStandardStrings = [ @@ -32981,8 +32982,123 @@ var CFFStandardStrings = [
];
// Type1Font is also a CIDFontType0.
var Type1Font = function Type1Font(name, file, properties) {
// Some bad generators embed pfb file as is, we have to strip 6-byte headers.
var Type1Font = (function Type1FontClosure() {
function findBlock(streamBytes, signature, startIndex) {
var streamBytesLength = streamBytes.length;
var signatureLength = signature.length;
var scanLength = streamBytesLength - signatureLength;
var i = startIndex, j, found = false;
while (i < scanLength) {
j = 0;
while (j < signatureLength && streamBytes[i + j] === signature[j]) {
j++;
}
if (j >= signatureLength) { // `signature` found, skip over whitespace.
i += j;
while (i < streamBytesLength && Lexer.isSpace(streamBytes[i])) {
i++;
}
found = true;
break;
}
i++;
}
return {
found: found,
length: i,
};
}
function getHeaderBlock(stream, suggestedLength) {
var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
var streamStartPos = stream.pos; // Save the initial stream position.
var headerBytes, headerBytesLength, block;
try {
headerBytes = stream.getBytes(suggestedLength);
headerBytesLength = headerBytes.length;
} catch (ex) {
if (ex instanceof MissingDataException) {
throw ex;
}
// Ignore errors if the `suggestedLength` is huge enough that a Uint8Array
// cannot hold the result of `getBytes`, and fallback to simply checking
// the entire stream (fixes issue3928.pdf).
}
if (headerBytesLength === suggestedLength) {
// Most of the time `suggestedLength` is correct, so to speed things up we
// initially only check the last few bytes to see if the header was found.
// Otherwise we (potentially) check the entire stream to prevent errors in
// `Type1Parser` (fixes issue5686.pdf).
block = findBlock(headerBytes, EEXEC_SIGNATURE,
suggestedLength - 2 * EEXEC_SIGNATURE.length);
if (block.found && block.length === suggestedLength) {
return {
stream: new Stream(headerBytes),
length: suggestedLength,
};
}
}
warn('Invalid "Length1" property in Type1 font -- trying to recover.');
stream.pos = streamStartPos; // Reset the stream position.
var SCAN_BLOCK_LENGTH = 2048;
var actualLength;
while (true) {
var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
if (block.length === 0) {
break;
}
stream.pos += block.length; // Update the stream position.
if (block.found) {
actualLength = stream.pos - streamStartPos;
break;
}
}
stream.pos = streamStartPos; // Reset the stream position.
if (actualLength) {
return {
stream: new Stream(stream.getBytes(actualLength)),
length: actualLength,
};
}
warn('Unable to recover "Length1" property in Type1 font -- using as is.');
return {
stream: new Stream(stream.getBytes(suggestedLength)),
length: suggestedLength,
};
}
function getEexecBlock(stream, suggestedLength) {
// We should ideally parse the eexec block to ensure that `suggestedLength`
// is correct, so we don't truncate the block data if it's too small.
// However, this would also require checking if the fixed-content portion
// exists (using the 'Length3' property), and ensuring that it's valid.
//
// Given that `suggestedLength` almost always is correct, all the validation
// would require a great deal of unnecessary parsing for most fonts.
// To save time, we always fetch the entire stream instead, which also avoid
// issues if `suggestedLength` is huge (see comment in `getHeaderBlock`).
//
// NOTE: This means that the function can include the fixed-content portion
// in the returned eexec block. In practice this does *not* seem to matter,
// since `Type1Parser_extractFontProgram` will skip over any non-commands.
var eexecBytes = stream.getBytes();
return {
stream: new Stream(eexecBytes),
length: eexecBytes.length,
};
}
function Type1Font(name, file, properties) {
// Some bad generators embed pfb file as is, we have to strip 6-byte header.
// Also, length1 and length2 might be off by 6 bytes as well.
// http://www.math.ubc.ca/~cass/piscript/type1.pdf
var PFB_HEADER_SIZE = 6;
@ -32997,8 +33113,9 @@ var Type1Font = function Type1Font(name, file, properties) { @@ -32997,8 +33113,9 @@ var Type1Font = function Type1Font(name, file, properties) {
}
// Get the data block containing glyphs and subrs informations
var headerBlock = new Stream(file.getBytes(headerBlockLength));
var headerBlockParser = new Type1Parser(headerBlock);
var headerBlock = getHeaderBlock(file, headerBlockLength);
headerBlockLength = headerBlock.length;
var headerBlockParser = new Type1Parser(headerBlock.stream);
headerBlockParser.extractFontHeader(properties);
if (pfbHeaderPresent) {
@ -33008,8 +33125,9 @@ var Type1Font = function Type1Font(name, file, properties) { @@ -33008,8 +33125,9 @@ var Type1Font = function Type1Font(name, file, properties) {
}
// Decrypt the data blocks and retrieve it's content
var eexecBlock = new Stream(file.getBytes(eexecBlockLength));
var eexecBlockParser = new Type1Parser(eexecBlock, true);
var eexecBlock = getEexecBlock(file, eexecBlockLength);
eexecBlockLength = eexecBlock.length;
var eexecBlockParser = new Type1Parser(eexecBlock.stream, true);
var data = eexecBlockParser.extractFontProgram();
for (var info in data.properties) {
properties[info] = data.properties[info];
@ -33023,7 +33141,7 @@ var Type1Font = function Type1Font(name, file, properties) { @@ -33023,7 +33141,7 @@ var Type1Font = function Type1Font(name, file, properties) {
this.data = this.wrap(name, type2Charstrings, this.charstrings,
subrs, properties);
this.seacs = this.getSeacs(data.charstrings);
};
}
Type1Font.prototype = {
get numGlyphs() {
@ -33106,7 +33224,8 @@ Type1Font.prototype = { @@ -33106,7 +33224,8 @@ Type1Font.prototype = {
return type2Subrs;
},
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs,
properties) {
var cff = new CFF();
cff.header = new CFFHeader(1, 0, 4, 4);
@ -33207,6 +33326,9 @@ Type1Font.prototype = { @@ -33207,6 +33326,9 @@ Type1Font.prototype = {
}
};
return Type1Font;
})();
var CFFFont = (function CFFFontClosure() {
function CFFFont(file, properties) {
this.properties = properties;
@ -46977,6 +47099,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -46977,6 +47099,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
var length1 = fontFile.dict.get('Length1');
var length2 = fontFile.dict.get('Length2');
var length3 = fontFile.dict.get('Length3');
}
}
@ -46987,6 +47110,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -46987,6 +47110,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
file: fontFile,
length1: length1,
length2: length2,
length3: length3,
loadedName: baseDict.loadedName,
composite: composite,
wideChars: composite,

4
build/pdf.js

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {})); @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
// Use strict in our context only - users might not want it
'use strict';
var pdfjsVersion = '1.4.176';
var pdfjsBuild = '447c48e';
var pdfjsVersion = '1.4.179';
var pdfjsBuild = '8910cea';
var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ?

144
build/pdf.worker.js vendored

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {})); @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
// Use strict in our context only - users might not want it
'use strict';
var pdfjsVersion = '1.4.176';
var pdfjsBuild = '447c48e';
var pdfjsVersion = '1.4.179';
var pdfjsBuild = '8910cea';
var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ?
@ -25495,6 +25495,7 @@ var shadow = sharedUtil.shadow; @@ -25495,6 +25495,7 @@ var shadow = sharedUtil.shadow;
var stringToBytes = sharedUtil.stringToBytes;
var string32 = sharedUtil.string32;
var warn = sharedUtil.warn;
var MissingDataException = sharedUtil.MissingDataException;
var Stream = coreStream.Stream;
var Lexer = coreParser.Lexer;
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
@ -29078,8 +29079,123 @@ var CFFStandardStrings = [ @@ -29078,8 +29079,123 @@ var CFFStandardStrings = [
];
// Type1Font is also a CIDFontType0.
var Type1Font = function Type1Font(name, file, properties) {
// Some bad generators embed pfb file as is, we have to strip 6-byte headers.
var Type1Font = (function Type1FontClosure() {
function findBlock(streamBytes, signature, startIndex) {
var streamBytesLength = streamBytes.length;
var signatureLength = signature.length;
var scanLength = streamBytesLength - signatureLength;
var i = startIndex, j, found = false;
while (i < scanLength) {
j = 0;
while (j < signatureLength && streamBytes[i + j] === signature[j]) {
j++;
}
if (j >= signatureLength) { // `signature` found, skip over whitespace.
i += j;
while (i < streamBytesLength && Lexer.isSpace(streamBytes[i])) {
i++;
}
found = true;
break;
}
i++;
}
return {
found: found,
length: i,
};
}
function getHeaderBlock(stream, suggestedLength) {
var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
var streamStartPos = stream.pos; // Save the initial stream position.
var headerBytes, headerBytesLength, block;
try {
headerBytes = stream.getBytes(suggestedLength);
headerBytesLength = headerBytes.length;
} catch (ex) {
if (ex instanceof MissingDataException) {
throw ex;
}
// Ignore errors if the `suggestedLength` is huge enough that a Uint8Array
// cannot hold the result of `getBytes`, and fallback to simply checking
// the entire stream (fixes issue3928.pdf).
}
if (headerBytesLength === suggestedLength) {
// Most of the time `suggestedLength` is correct, so to speed things up we
// initially only check the last few bytes to see if the header was found.
// Otherwise we (potentially) check the entire stream to prevent errors in
// `Type1Parser` (fixes issue5686.pdf).
block = findBlock(headerBytes, EEXEC_SIGNATURE,
suggestedLength - 2 * EEXEC_SIGNATURE.length);
if (block.found && block.length === suggestedLength) {
return {
stream: new Stream(headerBytes),
length: suggestedLength,
};
}
}
warn('Invalid "Length1" property in Type1 font -- trying to recover.');
stream.pos = streamStartPos; // Reset the stream position.
var SCAN_BLOCK_LENGTH = 2048;
var actualLength;
while (true) {
var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
if (block.length === 0) {
break;
}
stream.pos += block.length; // Update the stream position.
if (block.found) {
actualLength = stream.pos - streamStartPos;
break;
}
}
stream.pos = streamStartPos; // Reset the stream position.
if (actualLength) {
return {
stream: new Stream(stream.getBytes(actualLength)),
length: actualLength,
};
}
warn('Unable to recover "Length1" property in Type1 font -- using as is.');
return {
stream: new Stream(stream.getBytes(suggestedLength)),
length: suggestedLength,
};
}
function getEexecBlock(stream, suggestedLength) {
// We should ideally parse the eexec block to ensure that `suggestedLength`
// is correct, so we don't truncate the block data if it's too small.
// However, this would also require checking if the fixed-content portion
// exists (using the 'Length3' property), and ensuring that it's valid.
//
// Given that `suggestedLength` almost always is correct, all the validation
// would require a great deal of unnecessary parsing for most fonts.
// To save time, we always fetch the entire stream instead, which also avoid
// issues if `suggestedLength` is huge (see comment in `getHeaderBlock`).
//
// NOTE: This means that the function can include the fixed-content portion
// in the returned eexec block. In practice this does *not* seem to matter,
// since `Type1Parser_extractFontProgram` will skip over any non-commands.
var eexecBytes = stream.getBytes();
return {
stream: new Stream(eexecBytes),
length: eexecBytes.length,
};
}
function Type1Font(name, file, properties) {
// Some bad generators embed pfb file as is, we have to strip 6-byte header.
// Also, length1 and length2 might be off by 6 bytes as well.
// http://www.math.ubc.ca/~cass/piscript/type1.pdf
var PFB_HEADER_SIZE = 6;
@ -29094,8 +29210,9 @@ var Type1Font = function Type1Font(name, file, properties) { @@ -29094,8 +29210,9 @@ var Type1Font = function Type1Font(name, file, properties) {
}
// Get the data block containing glyphs and subrs informations
var headerBlock = new Stream(file.getBytes(headerBlockLength));
var headerBlockParser = new Type1Parser(headerBlock);
var headerBlock = getHeaderBlock(file, headerBlockLength);
headerBlockLength = headerBlock.length;
var headerBlockParser = new Type1Parser(headerBlock.stream);
headerBlockParser.extractFontHeader(properties);
if (pfbHeaderPresent) {
@ -29105,8 +29222,9 @@ var Type1Font = function Type1Font(name, file, properties) { @@ -29105,8 +29222,9 @@ var Type1Font = function Type1Font(name, file, properties) {
}
// Decrypt the data blocks and retrieve it's content
var eexecBlock = new Stream(file.getBytes(eexecBlockLength));
var eexecBlockParser = new Type1Parser(eexecBlock, true);
var eexecBlock = getEexecBlock(file, eexecBlockLength);
eexecBlockLength = eexecBlock.length;
var eexecBlockParser = new Type1Parser(eexecBlock.stream, true);
var data = eexecBlockParser.extractFontProgram();
for (var info in data.properties) {
properties[info] = data.properties[info];
@ -29120,7 +29238,7 @@ var Type1Font = function Type1Font(name, file, properties) { @@ -29120,7 +29238,7 @@ var Type1Font = function Type1Font(name, file, properties) {
this.data = this.wrap(name, type2Charstrings, this.charstrings,
subrs, properties);
this.seacs = this.getSeacs(data.charstrings);
};
}
Type1Font.prototype = {
get numGlyphs() {
@ -29203,7 +29321,8 @@ Type1Font.prototype = { @@ -29203,7 +29321,8 @@ Type1Font.prototype = {
return type2Subrs;
},
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs,
properties) {
var cff = new CFF();
cff.header = new CFFHeader(1, 0, 4, 4);
@ -29304,6 +29423,9 @@ Type1Font.prototype = { @@ -29304,6 +29423,9 @@ Type1Font.prototype = {
}
};
return Type1Font;
})();
var CFFFont = (function CFFFontClosure() {
function CFFFont(file, properties) {
this.properties = properties;
@ -38810,6 +38932,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -38810,6 +38932,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
var length1 = fontFile.dict.get('Length1');
var length2 = fontFile.dict.get('Length2');
var length3 = fontFile.dict.get('Length3');
}
}
@ -38820,6 +38943,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -38820,6 +38943,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
file: fontFile,
length1: length1,
length2: length2,
length3: length3,
loadedName: baseDict.loadedName,
composite: composite,
wideChars: composite,

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.4.176",
"version": "1.4.179",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

Loading…
Cancel
Save