Ensure that PDFPageProxy.pageSizeInches handles non-default /Rotate entries correctly

Without this patch, the pageSize will be incorrectly reported for some PDF files.

---

Move pageSizeInches to ui_utils
This commit is contained in:
Jonas Jenwald 2018-03-19 17:27:04 +01:00
parent 0d391daccc
commit d547936827
5 changed files with 56 additions and 25 deletions

View file

@ -13,7 +13,9 @@
* limitations under the License.
*/
import { cloneObj, getPDFFileNameFromURL, NullL10n } from './ui_utils';
import {
cloneObj, getPageSizeInches, getPDFFileNameFromURL, NullL10n
} from './ui_utils';
import { createPromiseCapability } from 'pdfjs-lib';
const DEFAULT_FIELD_CONTENT = '-';
@ -92,7 +94,7 @@ class PDFDocumentProperties {
this._parseDate(info.CreationDate),
this._parseDate(info.ModDate),
this.pdfDocument.getPage(currentPageNumber).then((pdfPage) => {
return this._parsePageSize(pdfPage.pageSizeInches);
return this._parsePageSize(getPageSizeInches(pdfPage));
}),
]);
}).then(([info, metadata, fileName, fileSize, creationDate, modDate,