1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into charstoglyphs

Conflicts:
	test/test_manifest.json
This commit is contained in:
notmasteryet 2011-09-17 11:23:34 -05:00
commit 0b1b8da982
23 changed files with 417 additions and 121 deletions

View file

@ -8,6 +8,7 @@
'use strict';
var appPath, browser, canvas, currentTaskIdx, manifest, stdout;
var inFlightRequests = 0;
function queryParams() {
var qs = window.location.search.substring(1);
@ -42,7 +43,8 @@ function load() {
if (r.readyState == 4) {
log('done\n');
manifest = JSON.parse(r.responseText);
currentTaskIdx = 0, nextTask();
currentTaskIdx = 0;
nextTask();
}
};
r.send(null);
@ -73,7 +75,8 @@ function nextTask() {
failure = 'load PDF doc : ' + e.toString();
}
task.pageNum = 1, nextPage(task, failure);
task.pageNum = 1;
nextPage(task, failure);
}
};
r.send(null);
@ -89,7 +92,8 @@ function nextPage(task, loadError) {
if (!task.pdfDoc) {
sendTaskResult(canvas.toDataURL('image/png'), task, failure);
log('done' + (failure ? ' (failed !: ' + failure + ')' : '') + '\n');
++currentTaskIdx, nextTask();
++currentTaskIdx;
nextTask();
return;
}
@ -98,7 +102,8 @@ function nextPage(task, loadError) {
log(' Round ' + (1 + task.round) + '\n');
task.pageNum = 1;
} else {
++currentTaskIdx, nextTask();
++currentTaskIdx;
nextTask();
return;
}
}
@ -123,7 +128,7 @@ function nextPage(task, loadError) {
page.startRendering(
ctx,
function(e) {
snapshotCurrentPage(page, task, (!failure && e) ?
snapshotCurrentPage(task, (!failure && e) ?
('render : ' + e) : failure);
}
);
@ -135,11 +140,11 @@ function nextPage(task, loadError) {
if (failure) {
// Skip right to snapshotting if there was a failure, since the
// fonts might be in an inconsistent state.
snapshotCurrentPage(page, task, failure);
snapshotCurrentPage(task, failure);
}
}
function snapshotCurrentPage(page, task, failure) {
function snapshotCurrentPage(task, failure) {
log('done, snapshotting... ');
sendTaskResult(canvas.toDataURL('image/png'), task, failure);
@ -149,7 +154,8 @@ function snapshotCurrentPage(page, task, failure) {
var backoff = (inFlightRequests > 0) ? inFlightRequests * 10 : 0;
setTimeout(
function() {
++task.pageNum, nextPage(task);
++task.pageNum;
nextPage(task);
},
backoff
);
@ -182,7 +188,6 @@ function done() {
}
}
var inFlightRequests = 0;
function sendTaskResult(snapshot, task, failure) {
var result = { browser: browser,
id: task.id,
@ -201,7 +206,7 @@ function sendTaskResult(snapshot, task, failure) {
if (r.readyState == 4) {
inFlightRequests--;
}
}
};
document.getElementById('inFlightCount').innerHTML = inFlightRequests++;
r.send(JSON.stringify(result));
}

12
test/pdfs/.gitignore vendored
View file

@ -1,3 +1,13 @@
pdf.pdf
DiwanProfile.pdf
artofwar.pdf
cable.pdf
ecma262.pdf
hmm.pdf
i9.pdf
intelisa.pdf
openweb_tm-PRINT.pdf
pdf.pdf
pdkids.pdf
shavian.pdf
jai.pdf

View file

@ -0,0 +1 @@
http://www.airgid.com/book/wdsg_fitc.pdf

View file

@ -0,0 +1,2 @@
browser_manifest.json

View file

@ -116,6 +116,12 @@
"rounds": 1,
"type": "eq"
},
{ "id": "wdsg_fitc",
"file": "pdfs/wdsg_fitc.pdf",
"link": true,
"rounds": 1,
"type": "eq"
},
{ "id": "fips197",
"file": "pdfs/fips197.pdf",
"link": true,