mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Re-factor parsing of the Linearization dictionary
This commit is contained in:
parent
1e52c770d9
commit
a5c98aab36
2 changed files with 49 additions and 80 deletions
|
@ -358,22 +358,15 @@ var PDFDocument = (function PDFDocumentClosure() {
|
|||
},
|
||||
|
||||
get linearization() {
|
||||
var length = this.stream.length;
|
||||
var linearization = false;
|
||||
if (length) {
|
||||
var linearization = null;
|
||||
if (this.stream.length) {
|
||||
try {
|
||||
linearization = new Linearization(this.stream);
|
||||
if (linearization.length != length) {
|
||||
linearization = false;
|
||||
}
|
||||
linearization = Linearization.create(this.stream);
|
||||
} catch (err) {
|
||||
if (err instanceof MissingDataException) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
info('The linearization data is not available ' +
|
||||
'or unreadable PDF data is found');
|
||||
linearization = false;
|
||||
info(err);
|
||||
}
|
||||
}
|
||||
// shadow the prototype getter with a data property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue