1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Move the getPage call in PDFDocumentProperties class

This allows us to remove an ESLint disable-statement for `arrow-body-style`, without affecting readability of the code, and fetching the metadata and the page in parallel should be a *tiny* bit more efficient as well.
This commit is contained in:
Jonas Jenwald 2024-12-01 12:25:16 +01:00
parent 8f08ca2150
commit e5f744da04

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),
]); ]);