Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
b424ab6df4
@ -1,3 +1,7 @@
|
|||||||
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var ISOAdobeCharset = [
|
var ISOAdobeCharset = [
|
||||||
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
|
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
|
||||||
|
@ -131,8 +131,7 @@ pdfContentHandler.prototype = {
|
|||||||
throw Cr.NS_ERROR_WONT_HANDLE_CONTENT;
|
throw Cr.NS_ERROR_WONT_HANDLE_CONTENT;
|
||||||
|
|
||||||
let window = null;
|
let window = null;
|
||||||
let callbacks = aRequest.notificationCallbacks ?
|
let callbacks = aRequest.notificationCallbacks ||
|
||||||
aRequest.notificationCallbacks :
|
|
||||||
aRequest.loadGroup.notificationCallbacks;
|
aRequest.loadGroup.notificationCallbacks;
|
||||||
if (!callbacks)
|
if (!callbacks)
|
||||||
return;
|
return;
|
||||||
|
14
fonts.js
14
fonts.js
@ -710,7 +710,13 @@ var Font = (function Font() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function createOS2Table(properties, override) {
|
function createOS2Table(properties, override) {
|
||||||
var override = override || {};
|
override = override || {
|
||||||
|
unitsPerEm: 0,
|
||||||
|
yMax: 0,
|
||||||
|
yMin: 0,
|
||||||
|
ascent: 0,
|
||||||
|
descent: 0
|
||||||
|
};
|
||||||
|
|
||||||
var ulUnicodeRange1 = 0;
|
var ulUnicodeRange1 = 0;
|
||||||
var ulUnicodeRange2 = 0;
|
var ulUnicodeRange2 = 0;
|
||||||
@ -1322,7 +1328,8 @@ var Font = (function Font() {
|
|||||||
'OS/2': stringToArray(createOS2Table(properties)),
|
'OS/2': stringToArray(createOS2Table(properties)),
|
||||||
|
|
||||||
// Character to glyphs mapping
|
// Character to glyphs mapping
|
||||||
'cmap': createCMapTable(charstrings.slice(), font.glyphIds),
|
'cmap': createCMapTable(charstrings.slice(),
|
||||||
|
('glyphIds' in font) ? font.glyphIds: null),
|
||||||
|
|
||||||
// Font header
|
// Font header
|
||||||
'head': (function fontFieldsHead() {
|
'head': (function fontFieldsHead() {
|
||||||
@ -2612,7 +2619,8 @@ var Type2CFF = (function type2CFF() {
|
|||||||
if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255))
|
if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255))
|
||||||
unicode += kCmapGlyphOffset;
|
unicode += kCmapGlyphOffset;
|
||||||
|
|
||||||
var width = isNum(mapping.width) ? mapping.width : defaultWidth;
|
var width = ('width' in mapping) && isNum(mapping.width) ? mapping.width
|
||||||
|
: defaultWidth;
|
||||||
properties.encoding[code] = {
|
properties.encoding[code] = {
|
||||||
unicode: unicode,
|
unicode: unicode,
|
||||||
width: width
|
width: width
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var Metrics = {
|
var Metrics = {
|
||||||
'Courier': 600,
|
'Courier': 600,
|
||||||
'Courier-Bold': 600,
|
'Courier-Bold': 600,
|
||||||
|
120
pdf.js
120
pdf.js
@ -2021,6 +2021,25 @@ var CCITTFaxStream = (function ccittFaxStream() {
|
|||||||
return EOF;
|
return EOF;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var findTableCode = function ccittFaxStreamFindTableCode(start, end, table,
|
||||||
|
limit) {
|
||||||
|
for (var i = start; i <= end; ++i) {
|
||||||
|
var code = this.lookBits(i);
|
||||||
|
if (code == EOF)
|
||||||
|
return [true, 1];
|
||||||
|
if (i < end)
|
||||||
|
code <<= end - i;
|
||||||
|
if (code >= limit) {
|
||||||
|
var p = table[code - ((limit == ccittEOL) ? 0 : limit)];
|
||||||
|
if (p[0] == i) {
|
||||||
|
this.eatBits(i);
|
||||||
|
return [true, p[1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [false, 0];
|
||||||
|
};
|
||||||
|
|
||||||
constructor.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
|
constructor.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
|
||||||
var code = 0;
|
var code = 0;
|
||||||
var p;
|
var p;
|
||||||
@ -2040,31 +2059,13 @@ var CCITTFaxStream = (function ccittFaxStream() {
|
|||||||
return p[1];
|
return p[1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var n = 1; n <= 9; ++n) {
|
var result = findTableCode(1, 9, whiteTable2, ccittEOL);
|
||||||
code = this.lookBits(n);
|
if (result[0])
|
||||||
if (code == EOF)
|
return result[1];
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (n < 9)
|
result = findTableCode(11, 12, whiteTable1, ccittEOL);
|
||||||
code <<= 9 - n;
|
if (result[0])
|
||||||
p = whiteTable2[code];
|
return result[1];
|
||||||
if (p[0] == n) {
|
|
||||||
this.eatBits(n);
|
|
||||||
return p[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var n = 11; n <= 12; ++n) {
|
|
||||||
code = this.lookBits(n);
|
|
||||||
if (code == EOF)
|
|
||||||
return 1;
|
|
||||||
if (n < 12)
|
|
||||||
code <<= 12 - n;
|
|
||||||
p = whiteTable1[code];
|
|
||||||
if (p[0] == n) {
|
|
||||||
this.eatBits(n);
|
|
||||||
return p[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
warn('bad white code');
|
warn('bad white code');
|
||||||
this.eatBits(1);
|
this.eatBits(1);
|
||||||
@ -2089,45 +2090,17 @@ var CCITTFaxStream = (function ccittFaxStream() {
|
|||||||
return p[1];
|
return p[1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var n;
|
var result = findTableCode(2, 6, blackTable3, ccittEOL);
|
||||||
for (n = 2; n <= 6; ++n) {
|
if (result[0])
|
||||||
code = this.lookBits(n);
|
return result[1];
|
||||||
if (code == EOF)
|
|
||||||
return 1;
|
result = findTableCode(7, 12, blackTable2, 64);
|
||||||
if (n < 6)
|
if (result[0])
|
||||||
code <<= 6 - n;
|
return result[1];
|
||||||
p = blackTable3[code];
|
|
||||||
if (p[0] == n) {
|
result = findTableCode(10, 13, blackTable1, ccittEOL);
|
||||||
this.eatBits(n);
|
if (result[0])
|
||||||
return p[1];
|
return result[1];
|
||||||
}
|
|
||||||
}
|
|
||||||
for (n = 7; n <= 12; ++n) {
|
|
||||||
code = this.lookBits(n);
|
|
||||||
if (code == EOF)
|
|
||||||
return 1;
|
|
||||||
if (n < 12)
|
|
||||||
code <<= 12 - n;
|
|
||||||
if (code >= 64) {
|
|
||||||
p = blackTable2[code - 64];
|
|
||||||
if (p[0] == n) {
|
|
||||||
this.eatBits(n);
|
|
||||||
return p[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (n = 10; n <= 13; ++n) {
|
|
||||||
code = this.lookBits(n);
|
|
||||||
if (code == EOF)
|
|
||||||
return 1;
|
|
||||||
if (n < 13)
|
|
||||||
code <<= 13 - n;
|
|
||||||
p = blackTable1[code];
|
|
||||||
if (p[0] == n) {
|
|
||||||
this.eatBits(n);
|
|
||||||
return p[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
warn('bad black code');
|
warn('bad black code');
|
||||||
this.eatBits(1);
|
this.eatBits(1);
|
||||||
@ -4381,6 +4354,10 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var patterns = xref.fetchIfRef(resources.get('Pattern')) || new Dict();
|
var patterns = xref.fetchIfRef(resources.get('Pattern')) || new Dict();
|
||||||
var parser = new Parser(new Lexer(stream), false);
|
var parser = new Parser(new Lexer(stream), false);
|
||||||
var args = [], argsArray = [], fnArray = [], obj;
|
var args = [], argsArray = [], fnArray = [], obj;
|
||||||
|
var getObjBt = function getObjBt() {
|
||||||
|
parser = this.oldParser;
|
||||||
|
return { name: 'BT' };
|
||||||
|
};
|
||||||
|
|
||||||
while (!isEOF(obj = parser.getObj())) {
|
while (!isEOF(obj = parser.getObj())) {
|
||||||
if (isCmd(obj)) {
|
if (isCmd(obj)) {
|
||||||
@ -4392,10 +4369,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
fn = OP_MAP[cmd.substr(0, cmd.length - 2)];
|
fn = OP_MAP[cmd.substr(0, cmd.length - 2)];
|
||||||
// feeding 'BT' on next interation
|
// feeding 'BT' on next interation
|
||||||
parser = {
|
parser = {
|
||||||
getObj: function() {
|
getObj: getObjBt,
|
||||||
parser = this.oldParser;
|
|
||||||
return { name: 'BT' };
|
|
||||||
},
|
|
||||||
oldParser: parser
|
oldParser: parser
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -5162,7 +5136,8 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
stroke: function canvasGraphicsStroke() {
|
stroke: function canvasGraphicsStroke() {
|
||||||
var ctx = this.ctx;
|
var ctx = this.ctx;
|
||||||
var strokeColor = this.current.strokeColor;
|
var strokeColor = this.current.strokeColor;
|
||||||
if (strokeColor && strokeColor.type === 'Pattern') {
|
if (strokeColor && strokeColor.hasOwnProperty('type') &&
|
||||||
|
strokeColor.type === 'Pattern') {
|
||||||
// for patterns, we transform to pattern space, calculate
|
// for patterns, we transform to pattern space, calculate
|
||||||
// the pattern, call stroke, and restore to user space
|
// the pattern, call stroke, and restore to user space
|
||||||
ctx.save();
|
ctx.save();
|
||||||
@ -5183,7 +5158,8 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
var ctx = this.ctx;
|
var ctx = this.ctx;
|
||||||
var fillColor = this.current.fillColor;
|
var fillColor = this.current.fillColor;
|
||||||
|
|
||||||
if (fillColor && fillColor.type === 'Pattern') {
|
if (fillColor && fillColor.hasOwnProperty('type') &&
|
||||||
|
fillColor.type === 'Pattern') {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.fillStyle = fillColor.getPattern(ctx);
|
ctx.fillStyle = fillColor.getPattern(ctx);
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
@ -5203,7 +5179,8 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
var ctx = this.ctx;
|
var ctx = this.ctx;
|
||||||
|
|
||||||
var fillColor = this.current.fillColor;
|
var fillColor = this.current.fillColor;
|
||||||
if (fillColor && fillColor.type === 'Pattern') {
|
if (fillColor && fillColor.hasOwnProperty('type') &&
|
||||||
|
fillColor.type === 'Pattern') {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.fillStyle = fillColor.getPattern(ctx);
|
ctx.fillStyle = fillColor.getPattern(ctx);
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
@ -5213,7 +5190,8 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var strokeColor = this.current.strokeColor;
|
var strokeColor = this.current.strokeColor;
|
||||||
if (strokeColor && strokeColor.type === 'Pattern') {
|
if (strokeColor && strokeColor.hasOwnProperty('type') &&
|
||||||
|
strokeColor.type === 'Pattern') {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.strokeStyle = strokeColor.getPattern(ctx);
|
ctx.strokeStyle = strokeColor.getPattern(ctx);
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
// IE9 text/html data URI
|
// IE9 text/html data URI
|
||||||
(function checkDocumentDocumentModeCompatibility() {
|
(function checkDocumentDocumentModeCompatibility() {
|
||||||
if (document.documentMode !== 9)
|
if (!('documentMode' in document) || document.documentMode !== 9)
|
||||||
return;
|
return;
|
||||||
// overriding the src property
|
// overriding the src property
|
||||||
var originalSrcDescriptor = Object.getOwnPropertyDescriptor(
|
var originalSrcDescriptor = Object.getOwnPropertyDescriptor(
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<button id="previous" onclick="PDFView.page--;">
|
<button id="previous" onclick="PDFView.page--;" oncontextmenu="return false;">
|
||||||
<img src="images/go-up.svg" align="top" height="32"/>
|
<img src="images/go-up.svg" align="top" height="32"/>
|
||||||
Previous
|
Previous
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button id="next" onclick="PDFView.page++;">
|
<button id="next" onclick="PDFView.page++;" oncontextmenu="return false;">
|
||||||
<img src="images/go-down.svg" align="top" height="32"/>
|
<img src="images/go-down.svg" align="top" height="32"/>
|
||||||
Next
|
Next
|
||||||
</button>
|
</button>
|
||||||
@ -36,16 +36,16 @@
|
|||||||
|
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
<button id="next" title="Zoom Out" onclick="PDFView.zoomOut();">
|
<button id="zoomOut" title="Zoom Out" onclick="PDFView.zoomOut();" oncontextmenu="return false;">
|
||||||
<img src="images/zoom-out.svg" align="top" height="32"/>
|
<img src="images/zoom-out.svg" align="top" height="32"/>
|
||||||
</button>
|
</button>
|
||||||
<button id="next" title="Zoom In" onclick="PDFView.zoomIn();">
|
<button id="zoomIn" title="Zoom In" onclick="PDFView.zoomIn();" oncontextmenu="return false;">
|
||||||
<img src="images/zoom-in.svg" align="top" height="32"/>
|
<img src="images/zoom-in.svg" align="top" height="32"/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
<select id="scaleSelect" onchange="PDFView.parseScale(this.value);">
|
<select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;">
|
||||||
<option id="customScaleOption" value="custom"></option>
|
<option id="customScaleOption" value="custom"></option>
|
||||||
<option value="0.5">50%</option>
|
<option value="0.5">50%</option>
|
||||||
<option value="0.75">75%</option>
|
<option value="0.75">75%</option>
|
||||||
@ -59,14 +59,14 @@
|
|||||||
|
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
<button id="print" onclick="window.print();">
|
<button id="print" onclick="window.print();" oncontextmenu="return false;">
|
||||||
<img src="images/document-print.svg" align="top" height="32"/>
|
<img src="images/document-print.svg" align="top" height="32"/>
|
||||||
Print
|
Print
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
<input id="fileInput" type="file"/>
|
<input id="fileInput" type="file" oncontextmenu="return false;"/>
|
||||||
|
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
|
@ -178,7 +178,9 @@ var PDFView = {
|
|||||||
|
|
||||||
while (sidebar.hasChildNodes())
|
while (sidebar.hasChildNodes())
|
||||||
sidebar.removeChild(sidebar.lastChild);
|
sidebar.removeChild(sidebar.lastChild);
|
||||||
clearInterval(sidebar._loadingInterval);
|
|
||||||
|
if ('_loadingInterval' in sidebar)
|
||||||
|
clearInterval(sidebar._loadingInterval);
|
||||||
|
|
||||||
var container = document.getElementById('viewer');
|
var container = document.getElementById('viewer');
|
||||||
while (container.hasChildNodes())
|
while (container.hasChildNodes())
|
||||||
@ -544,7 +546,8 @@ window.addEventListener('load', function webViewerLoad(evt) {
|
|||||||
params[unescape(param[0])] = unescape(param[1]);
|
params[unescape(param[0])] = unescape(param[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFView.open(params.file || kDefaultURL, parseFloat(params.scale));
|
var scale = ('scale' in params) ? params.scale : kDefaultScale;
|
||||||
|
PDFView.open(params.file || kDefaultURL, parseFloat(scale));
|
||||||
|
|
||||||
if (!window.File || !window.FileReader || !window.FileList || !window.Blob)
|
if (!window.File || !window.FileReader || !window.FileList || !window.Blob)
|
||||||
document.getElementById('fileInput').style.display = 'none';
|
document.getElementById('fileInput').style.display = 'none';
|
||||||
|
Loading…
Reference in New Issue
Block a user