1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 23:28:06 +02:00

Add orientation description to the pageSize information, displayed in the properties dialog

Since the l10n strings were added in a previous commit, modifying them here shouldn't be a problem since they haven't landed in mozilla-central yet.
This commit is contained in:
Jonas Jenwald 2018-03-20 13:58:55 +01:00
parent f3b74c5028
commit fc0038d609
3 changed files with 19 additions and 9 deletions

View file

@ -14,7 +14,8 @@
*/
import {
cloneObj, getPageSizeInches, getPDFFileNameFromURL, NullL10n
cloneObj, getPageSizeInches, getPDFFileNameFromURL, isPortraitOrientation,
NullL10n
} from './ui_utils';
import { createPromiseCapability } from 'pdfjs-lib';
@ -266,6 +267,7 @@ class PDFDocumentProperties {
height: pageSizeInches.width,
};
}
const isPortrait = isPortraitOrientation(pageSizeInches);
const sizeInches = {
width: Math.round(pageSizeInches.width * 100) / 100,
@ -282,12 +284,16 @@ class PDFDocumentProperties {
this.l10n.get('document_properties_page_size_unit_' +
(this._isNonMetricLocale ? 'inches' : 'millimeters'), null,
this._isNonMetricLocale ? 'in' : 'mm'),
]).then(([{ width, height, }, unit]) => {
this.l10n.get('document_properties_page_size_orientation_' +
(isPortrait ? 'portrait' : 'landscape'), null,
isPortrait ? 'portrait' : 'landscape'),
]).then(([{ width, height, }, unit, orientation]) => {
return this.l10n.get('document_properties_page_size_dimension_string', {
width: width.toLocaleString(),
height: height.toLocaleString(),
unit,
}, '{{width}} × {{height}} {{unit}}');
orientation,
}, '{{width}} × {{height}} {{unit}} ({{orientation}})');
});
}