Merge pull request #1052 from notmasteryet/tree-56
Replacing non-existent page content with empty one
This commit is contained in:
commit
15bbbdc86d
@ -196,6 +196,9 @@ var Page = (function PageClosure() {
|
|||||||
for (i = 0; i < n; ++i)
|
for (i = 0; i < n; ++i)
|
||||||
content[i] = xref.fetchIfRef(content[i]);
|
content[i] = xref.fetchIfRef(content[i]);
|
||||||
content = new StreamsSequenceStream(content);
|
content = new StreamsSequenceStream(content);
|
||||||
|
} else if (!content) {
|
||||||
|
// replacing non-existent page content with empty one
|
||||||
|
content = new Stream(new Uint8Array(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
var pe = this.pe = new PartialEvaluator(
|
var pe = this.pe = new PartialEvaluator(
|
||||||
|
@ -78,6 +78,14 @@ function cleanup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exceptionToString(e) {
|
||||||
|
if (typeof e !== 'object')
|
||||||
|
return String(e);
|
||||||
|
if (!('message' in e))
|
||||||
|
return JSON.stringify(e);
|
||||||
|
return e.message + ('stack' in e ? ' at ' + e.stack.split('\n')[0] : '');
|
||||||
|
}
|
||||||
|
|
||||||
function nextTask() {
|
function nextTask() {
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
@ -95,7 +103,7 @@ function nextTask() {
|
|||||||
try {
|
try {
|
||||||
task.pdfDoc = new PDFJS.PDFDoc(data);
|
task.pdfDoc = new PDFJS.PDFDoc(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
failure = 'load PDF doc : ' + e.toString();
|
failure = 'load PDF doc : ' + exceptionToString(e);
|
||||||
}
|
}
|
||||||
task.pageNum = task.firstPage || 1;
|
task.pageNum = task.firstPage || 1;
|
||||||
nextPage(task, failure);
|
nextPage(task, failure);
|
||||||
@ -185,7 +193,7 @@ function nextPage(task, loadError) {
|
|||||||
textLayerBuilder
|
textLayerBuilder
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
failure = 'page setup : ' + e.toString();
|
failure = 'page setup : ' + exceptionToString(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test/pdfs/liveprogramming.pdf.link
Normal file
1
test/pdfs/liveprogramming.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://blog.lassus.se/files/liveprogramming.pdf
|
@ -395,5 +395,13 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
|
},
|
||||||
|
{ "id": "liveprogramming",
|
||||||
|
"file": "pdfs/liveprogramming.pdf",
|
||||||
|
"md5": "7bd4dad1188232ef597d36fd72c33e52",
|
||||||
|
"rounds": 1,
|
||||||
|
"pageLimit": 3,
|
||||||
|
"link": true,
|
||||||
|
"type": "load"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user