Merge remote branch 'upstream/master' into metrics
This commit is contained in:
commit
c93ffd645f
31
pdf.js
31
pdf.js
@ -2415,7 +2415,7 @@ var Lexer = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor.isSpace = function(ch) {
|
constructor.isSpace = function(ch) {
|
||||||
return ch == ' ' || ch == '\t' || ch == '\x0d';
|
return ch == ' ' || ch == '\t' || ch == '\x0d' || ch == '\x0a';
|
||||||
};
|
};
|
||||||
|
|
||||||
// A '1' in this array means the character is white space. A '1' or
|
// A '1' in this array means the character is white space. A '1' or
|
||||||
@ -3094,10 +3094,11 @@ var XRef = (function() {
|
|||||||
// check for 'XRefStm' key
|
// check for 'XRefStm' key
|
||||||
if (IsInt(obj = dict.get('XRefStm'))) {
|
if (IsInt(obj = dict.get('XRefStm'))) {
|
||||||
var pos = obj;
|
var pos = obj;
|
||||||
if (pos in this.xrefstms)
|
// ignore previously loaded xref streams (possible infinite recursion)
|
||||||
error('Invalid XRef table');
|
if (!(pos in this.xrefstms)) {
|
||||||
this.xrefstms[pos] = 1; // avoid infinite recursion
|
this.xrefstms[pos] = 1;
|
||||||
this.readXRef(pos);
|
this.readXRef(pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dict;
|
return dict;
|
||||||
@ -4184,7 +4185,7 @@ var PartialEvaluator = (function() {
|
|||||||
if (typeNum == 1) {
|
if (typeNum == 1) {
|
||||||
patternName.code = this.evaluate(pattern, xref,
|
patternName.code = this.evaluate(pattern, xref,
|
||||||
dict.get('Resources'),
|
dict.get('Resources'),
|
||||||
fonts);
|
fonts, images);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4324,14 +4325,16 @@ var PartialEvaluator = (function() {
|
|||||||
baseEncoding = Encodings[baseName.name].slice();
|
baseEncoding = Encodings[baseName.name].slice();
|
||||||
|
|
||||||
// Load the differences between the base and original
|
// Load the differences between the base and original
|
||||||
var diffEncoding = encoding.get('Differences');
|
if (encoding.has('Differences')) {
|
||||||
var index = 0;
|
var diffEncoding = encoding.get('Differences');
|
||||||
for (var j = 0; j < diffEncoding.length; j++) {
|
var index = 0;
|
||||||
var data = diffEncoding[j];
|
for (var j = 0; j < diffEncoding.length; j++) {
|
||||||
if (IsNum(data))
|
var data = diffEncoding[j];
|
||||||
index = data;
|
if (IsNum(data))
|
||||||
else
|
index = data;
|
||||||
differences[index++] = data.name;
|
else
|
||||||
|
differences[index++] = data.name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (IsName(encoding)) {
|
} else if (IsName(encoding)) {
|
||||||
baseEncoding = Encodings[encoding.name].slice();
|
baseEncoding = Encodings[encoding.name].slice();
|
||||||
|
1
test/pdfs/f1040.pdf.link
Normal file
1
test/pdfs/f1040.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://www.irs.gov/pub/irs-pdf/f1040.pdf
|
1
test/pdfs/txt2pdf.pdf.link
Normal file
1
test/pdfs/txt2pdf.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://www.sanface.com/pdf/test.pdf
|
@ -133,5 +133,17 @@
|
|||||||
"link": true,
|
"link": true,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
|
},
|
||||||
|
{ "id": "txt2pdf",
|
||||||
|
"file": "pdfs/txt2pdf.pdf",
|
||||||
|
"link": true,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "load"
|
||||||
|
},
|
||||||
|
{ "id": "f1040",
|
||||||
|
"file": "pdfs/f1040.pdf",
|
||||||
|
"link": true,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "load"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -271,3 +271,8 @@ canvas {
|
|||||||
page-break-after: always;
|
page-break-after: always;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#loading {
|
||||||
|
margin: 100px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
@ -90,7 +90,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="loading">Loading... 0%</div>
|
||||||
<div id="viewer"></div>
|
<div id="viewer"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -111,12 +111,14 @@ var PDFView = {
|
|||||||
xhr.open('GET', url);
|
xhr.open('GET', url);
|
||||||
xhr.mozResponseType = xhr.responseType = 'arraybuffer';
|
xhr.mozResponseType = xhr.responseType = 'arraybuffer';
|
||||||
xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200;
|
xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200;
|
||||||
|
xhr.onprogress = PDFView.progressLevel;
|
||||||
|
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4 && xhr.status === xhr.expected) {
|
if (xhr.readyState === 4 && xhr.status === xhr.expected) {
|
||||||
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
|
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
|
||||||
xhr.responseArrayBuffer || xhr.response);
|
xhr.responseArrayBuffer || xhr.response);
|
||||||
|
|
||||||
|
document.getElementById('loading').style.display = 'none';
|
||||||
PDFView.load(data, scale);
|
PDFView.load(data, scale);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -124,6 +126,11 @@ var PDFView = {
|
|||||||
xhr.send(null);
|
xhr.send(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
progressLevel: function(evt) {
|
||||||
|
var p = Math.round((evt.loaded / evt.total) * 100);
|
||||||
|
document.getElementById('loading').innerHTML = 'Loading... ' + p + '%';
|
||||||
|
},
|
||||||
|
|
||||||
navigateTo: function(dest) {
|
navigateTo: function(dest) {
|
||||||
if (typeof dest === 'string')
|
if (typeof dest === 'string')
|
||||||
dest = this.destinations[dest];
|
dest = this.destinations[dest];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user