Skip to content

Commit

Permalink
Updated to v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tanaikech committed Aug 18, 2023
1 parent 12865eb commit c378a18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PDFApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ class PDFApp {
try {
const metadata = keys.reduce((o, k) => ((o[k] = pdfData[`get${k.charAt(0).toUpperCase() + k.slice(1)}`]() || null), o), {});
metadata.numberOfPages = pdfData.getPageCount();
const pdfDoc = await this.PDFLib.PDFDocument.create();
const pages = await pdfDoc.copyPages(pdfData, [...Array(pdfData.getPageCount())].map((_, i) => i));
metadata.pageInfo = pages.map((page, i) => {
const { width, height } = page.getSize();
const { x, y } = page.getPosition();
return { page: i + 1, pageWidth: width, pageHeight: height, defaultPositionX: x, defaultPositionY: y };
});
resolve(metadata);
} catch (err) {
reject(err);
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -909,4 +909,8 @@ PDFApp.setPDFBlob(blob).embedObjects(object)

1. Initial release.

- v1.0.1 (August 18, 2023)

1. About the method of "getMetadata", `pageInfo` is added to the retrieved metadata. By this, each page size can be obtained.

[TOP](#top)

0 comments on commit c378a18

Please sign in to comment.