|
|
@ -266,6 +266,18 @@ var Catalog = (function CatalogClosure() { |
|
|
|
return shadow(this, 'toplevelPagesDict', pagesObj); |
|
|
|
return shadow(this, 'toplevelPagesDict', pagesObj); |
|
|
|
}, |
|
|
|
}, |
|
|
|
get documentOutline() { |
|
|
|
get documentOutline() { |
|
|
|
|
|
|
|
var obj = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
obj = this.readDocumentOutline(); |
|
|
|
|
|
|
|
} catch (ex) { |
|
|
|
|
|
|
|
if (ex instanceof MissingDataException) { |
|
|
|
|
|
|
|
throw ex; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
warn('Unable to read document outline'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return shadow(this, 'documentOutline', obj); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
readDocumentOutline: function Catalog_readDocumentOutline() { |
|
|
|
var xref = this.xref; |
|
|
|
var xref = this.xref; |
|
|
|
var obj = this.catDict.get('Outlines'); |
|
|
|
var obj = this.catDict.get('Outlines'); |
|
|
|
var root = { items: [] }; |
|
|
|
var root = { items: [] }; |
|
|
@ -316,8 +328,7 @@ var Catalog = (function CatalogClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
obj = root.items.length > 0 ? root.items : null; |
|
|
|
return root.items.length > 0 ? root.items : null; |
|
|
|
return shadow(this, 'documentOutline', obj); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
get numPages() { |
|
|
|
get numPages() { |
|
|
|
var obj = this.toplevelPagesDict.get('Count'); |
|
|
|
var obj = this.toplevelPagesDict.get('Count'); |
|
|
@ -598,6 +609,12 @@ var XRef = (function XRefClosure() { |
|
|
|
delete tableState.entryCount; |
|
|
|
delete tableState.entryCount; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Per issue 3248: hp scanners generate bad XRef
|
|
|
|
|
|
|
|
if (first === 1 && this.entries[1] && this.entries[1].free) { |
|
|
|
|
|
|
|
// shifting the entries
|
|
|
|
|
|
|
|
this.entries.shift(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Sanity check: as per spec, first object must be free
|
|
|
|
// Sanity check: as per spec, first object must be free
|
|
|
|
if (this.entries[0] && !this.entries[0].free) |
|
|
|
if (this.entries[0] && !this.entries[0].free) |
|
|
|
error('Invalid XRef table: unexpected first object'); |
|
|
|
error('Invalid XRef table: unexpected first object'); |
|
|
|