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:
parent
f3b74c5028
commit
fc0038d609
3 changed files with 19 additions and 9 deletions
|
@ -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}})');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue