Merge pull request #19137 from Snuffleupagus/PDFDocumentProperties-move-getPage

Move the `getPage` call in `PDFDocumentProperties` class
This commit is contained in:
Tim van der Meij 2024-12-01 14:44:43 +01:00 committed by GitHub
commit c40a0a6478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,12 +112,13 @@ class PDFDocumentProperties {
} }
// Get the document properties. // Get the document properties.
const { const [
info, { info, /* metadata, contentDispositionFilename, */ contentLength },
/* metadata, */ pdfPage,
/* contentDispositionFilename, */ ] = await Promise.all([
contentLength, this.pdfDocument.getMetadata(),
} = await this.pdfDocument.getMetadata(); this.pdfDocument.getPage(currentPageNumber),
]);
const [ const [
fileName, fileName,
@ -131,10 +132,7 @@ class PDFDocumentProperties {
this.#parseFileSize(contentLength), this.#parseFileSize(contentLength),
this.#parseDate(info.CreationDate), this.#parseDate(info.CreationDate),
this.#parseDate(info.ModDate), this.#parseDate(info.ModDate),
// eslint-disable-next-line arrow-body-style this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation),
this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
return this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation);
}),
this.#parseLinearization(info.IsLinearized), this.#parseLinearization(info.IsLinearized),
]); ]);