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

[api-minor] Add an IsLinearized property to the PDFDocument.documentInfo getter, to allow accessing the linearization status through the API (via PDFDocumentProxy.getMetadata)

There was a (somewhat) recent question on IRC about accessing the linearization status of a PDF document, and this patch contains a simple way to expose that through already existing API methods.
Please note that during setup/parsing in `PDFDocument` the linearization data is already being fetched and parsed, provided of course that it exists. Hence this patch will *not* cause any additional data to be loaded.
This commit is contained in:
Jonas Jenwald 2018-07-24 15:02:14 +02:00
parent 8a4466139b
commit 928b89382e
2 changed files with 16 additions and 7 deletions

View file

@ -535,12 +535,13 @@ var PDFDocument = (function PDFDocumentClosure() {
return shadow(this, 'numPages', num);
},
get documentInfo() {
var docInfo = {
const docInfo = {
PDFFormatVersion: this.pdfFormatVersion,
IsLinearized: !!this.linearization,
IsAcroFormPresent: !!this.acroForm,
IsXFAPresent: !!this.xfa,
};
var infoDict;
let infoDict;
try {
infoDict = this.xref.trailer.get('Info');
} catch (err) {