Skip to content

Commit

Permalink
Merge pull request #19137 from Snuffleupagus/PDFDocumentProperties-mo…
Browse files Browse the repository at this point in the history
…ve-getPage

Move the `getPage` call in `PDFDocumentProperties` class
  • Loading branch information
timvandermeij authored Dec 1, 2024
2 parents 9f90bc9 + e5f744d commit c40a0a6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions web/pdf_document_properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ class PDFDocumentProperties {
}

// Get the document properties.
const {
info,
/* metadata, */
/* contentDispositionFilename, */
contentLength,
} = await this.pdfDocument.getMetadata();
const [
{ info, /* metadata, contentDispositionFilename, */ contentLength },
pdfPage,
] = await Promise.all([
this.pdfDocument.getMetadata(),
this.pdfDocument.getPage(currentPageNumber),
]);

const [
fileName,
Expand All @@ -131,10 +132,7 @@ class PDFDocumentProperties {
this.#parseFileSize(contentLength),
this.#parseDate(info.CreationDate),
this.#parseDate(info.ModDate),
// eslint-disable-next-line arrow-body-style
this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
return this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation);
}),
this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation),
this.#parseLinearization(info.IsLinearized),
]);

Expand Down

0 comments on commit c40a0a6

Please sign in to comment.