|
@@ -83,15 +83,18 @@ var PDFDocumentProperties = function () {
|
|
|
metadata = _ref2.metadata,
|
|
|
contentDispositionFilename = _ref2.contentDispositionFilename;
|
|
|
|
|
|
- return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(_this.url), _this._parseFileSize(_this.maybeFileSize), _this._parseDate(info.CreationDate), _this._parseDate(info.ModDate)]);
|
|
|
+ return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(_this.url), _this._parseFileSize(_this.maybeFileSize), _this._parseDate(info.CreationDate), _this._parseDate(info.ModDate), _this.pdfDocument.getPageSizeInches().then(function (pageSizeInches) {
|
|
|
+ return _this._parsePageSize(pageSizeInches);
|
|
|
+ })]);
|
|
|
}).then(function (_ref3) {
|
|
|
- var _ref4 = _slicedToArray(_ref3, 6),
|
|
|
+ var _ref4 = _slicedToArray(_ref3, 7),
|
|
|
info = _ref4[0],
|
|
|
metadata = _ref4[1],
|
|
|
fileName = _ref4[2],
|
|
|
fileSize = _ref4[3],
|
|
|
creationDate = _ref4[4],
|
|
|
- modDate = _ref4[5];
|
|
|
+ modDate = _ref4[5],
|
|
|
+ pageSize = _ref4[6];
|
|
|
|
|
|
freezeFieldData({
|
|
|
'fileName': fileName,
|
|
@@ -105,7 +108,9 @@ var PDFDocumentProperties = function () {
|
|
|
'creator': info.Creator,
|
|
|
'producer': info.Producer,
|
|
|
'version': info.PDFFormatVersion,
|
|
|
- 'pageCount': _this.pdfDocument.numPages
|
|
|
+ 'pageCount': _this.pdfDocument.numPages,
|
|
|
+ 'pageSizeInch': pageSize.inch,
|
|
|
+ 'pageSizeMM': pageSize.mm
|
|
|
});
|
|
|
_this._updateUI();
|
|
|
return _this.pdfDocument.getDownloadInfo();
|
|
@@ -194,6 +199,29 @@ var PDFDocumentProperties = function () {
|
|
|
size_b: fileSize.toLocaleString()
|
|
|
}, '{{size_mb}} MB ({{size_b}} bytes)');
|
|
|
}
|
|
|
+ }, {
|
|
|
+ key: '_parsePageSize',
|
|
|
+ value: function _parsePageSize(pageSizeInches) {
|
|
|
+ if (!pageSizeInches) {
|
|
|
+ return Promise.resolve([undefined, undefined]);
|
|
|
+ }
|
|
|
+ var sizes_two_units = {
|
|
|
+ 'width_in': Math.round(pageSizeInches.width * 100) / 100,
|
|
|
+ 'height_in': Math.round(pageSizeInches.height * 100) / 100,
|
|
|
+ 'width_mm': Math.round(pageSizeInches.width * 25.4 * 10) / 10,
|
|
|
+ 'height_mm': Math.round(pageSizeInches.height * 25.4 * 10) / 10
|
|
|
+ };
|
|
|
+ return Promise.all([this.l10n.get('document_properties_page_size_in', sizes_two_units, '{{width_in}} in × {{height_in}} in'), this.l10n.get('document_properties_page_size_mm', sizes_two_units, '{{width_mm}} mm × {{height_mm}} mm')]).then(function (_ref6) {
|
|
|
+ var _ref7 = _slicedToArray(_ref6, 2),
|
|
|
+ parsedPageSizeInches = _ref7[0],
|
|
|
+ parsedPageSizeMM = _ref7[1];
|
|
|
+
|
|
|
+ return Promise.resolve({
|
|
|
+ inch: parsedPageSizeInches,
|
|
|
+ mm: parsedPageSizeMM
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}, {
|
|
|
key: '_parseDate',
|
|
|
value: function _parseDate(inputDate) {
|