Browse Source

Merge remote branch 'upstream/master'

Vivien Nicolas 14 years ago
parent
commit
1539e89ed7
  1. 6
      pdf.js
  2. 1
      test/pdfs/txt2pdf.pdf.link
  3. 6
      test/test_manifest.json
  4. 5
      web/viewer.css
  5. 1
      web/viewer.html
  6. 7
      web/viewer.js

6
pdf.js

@ -2415,7 +2415,7 @@ var Lexer = (function() { @@ -2415,7 +2415,7 @@ var Lexer = (function() {
}
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
@ -4184,7 +4184,7 @@ var PartialEvaluator = (function() { @@ -4184,7 +4184,7 @@ var PartialEvaluator = (function() {
if (typeNum == 1) {
patternName.code = this.evaluate(pattern, xref,
dict.get('Resources'),
fonts);
fonts, images);
}
}
}
@ -4324,6 +4324,7 @@ var PartialEvaluator = (function() { @@ -4324,6 +4324,7 @@ var PartialEvaluator = (function() {
baseEncoding = Encodings[baseName.name].slice();
// Load the differences between the base and original
if (encoding.has('Differences')) {
var diffEncoding = encoding.get('Differences');
var index = 0;
for (var j = 0; j < diffEncoding.length; j++) {
@ -4333,6 +4334,7 @@ var PartialEvaluator = (function() { @@ -4333,6 +4334,7 @@ var PartialEvaluator = (function() {
else
differences[index++] = data.name;
}
}
} else if (IsName(encoding)) {
baseEncoding = Encodings[encoding.name].slice();
} else {

1
test/pdfs/txt2pdf.pdf.link

@ -0,0 +1 @@ @@ -0,0 +1 @@
http://www.sanface.com/pdf/test.pdf

6
test/test_manifest.json

@ -133,5 +133,11 @@ @@ -133,5 +133,11 @@
"link": true,
"rounds": 1,
"type": "load"
},
{ "id": "txt2pdf",
"file": "pdfs/txt2pdf.pdf",
"link": true,
"rounds": 1,
"type": "load"
}
]

5
web/viewer.css

@ -271,3 +271,8 @@ canvas { @@ -271,3 +271,8 @@ canvas {
page-break-after: always;
}
}
#loading {
margin: 100px 0;
text-align: center;
}

1
web/viewer.html

@ -90,6 +90,7 @@ @@ -90,6 +90,7 @@
</div>
</div>
<div id="loading">Loading... 0%</div>
<div id="viewer"></div>
</body>
</html>

7
web/viewer.js

@ -111,12 +111,14 @@ var PDFView = { @@ -111,12 +111,14 @@ var PDFView = {
xhr.open('GET', url);
xhr.mozResponseType = xhr.responseType = 'arraybuffer';
xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200;
xhr.onprogress = PDFView.progressLevel;
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === xhr.expected) {
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
xhr.responseArrayBuffer || xhr.response);
document.getElementById('loading').style.display = "none";
PDFView.load(data, scale);
}
};
@ -124,6 +126,11 @@ var PDFView = { @@ -124,6 +126,11 @@ var PDFView = {
xhr.send(null);
},
progressLevel: function(evt) {
var p = Math.round((evt.loaded / evt.total) * 100);
document.getElementById('loading').innerHTML = 'Loading... ' + p + '%';
},
navigateTo: function(dest) {
if (typeof dest === 'string')
dest = this.destinations[dest];

Loading…
Cancel
Save