1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

Merge pull request #9920 from Snuffleupagus/getMetadata-linearization

[api-minor] Add an `IsLinearized` property to the `PDFDocument.documentInfo` getter, to allow accessing the linearization status through the API (via `PDFDocumentProxy.getMetadata`)
This commit is contained in:
Tim van der Meij 2018-07-29 20:23:22 +02:00 committed by GitHub
commit 3521424576
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 38 deletions

View file

@ -128,9 +128,10 @@ class PDFDocumentProperties {
return this._parsePageSize(getPageSizeInches(pdfPage),
pagesRotation);
}),
this._parseLinearization(info.IsLinearized),
]);
}).then(([info, metadata, fileName, fileSize, creationDate, modDate,
pageSize]) => {
pageSize, isLinearized]) => {
freezeFieldData({
'fileName': fileName,
'fileSize': fileSize,
@ -145,6 +146,7 @@ class PDFDocumentProperties {
'version': info.PDFFormatVersion,
'pageCount': this.pdfDocument.numPages,
'pageSize': pageSize,
'linearized': isLinearized,
'_currentPageNumber': currentPageNumber,
'_pagesRotation': pagesRotation,
});
@ -406,6 +408,15 @@ class PDFDocumentProperties {
{ date: dateString, time: timeString, },
'{{date}}, {{time}}');
}
/**
* @private
*/
_parseLinearization(isLinearized) {
return this.l10n.get('document_properties_linearized_' +
(isLinearized ? 'yes' : 'no'), null,
(isLinearized ? 'Yes' : 'No'));
}
}
export {

View file

@ -378,6 +378,10 @@ See https://github.com/adobe-type-tools/cmap-resources
<div class="row">
<span data-l10n-id="document_properties_page_size">Page Size:</span> <p id="pageSizeField">-</p>
</div>
<div class="separator"></div>
<div class="row">
<span data-l10n-id="document_properties_linearized">Fast Web View:</span> <p id="linearizedField">-</p>
</div>
<div class="buttonRow">
<button id="documentPropertiesClose" class="overlayButton"><span data-l10n-id="document_properties_close">Close</span></button>
</div>

View file

@ -166,6 +166,7 @@ function getViewerConfiguration() {
'version': document.getElementById('versionField'),
'pageCount': document.getElementById('pageCountField'),
'pageSize': document.getElementById('pageSizeField'),
'linearized': document.getElementById('linearizedField'),
},
},
errorWrapper: {