@shznet/pdf-sign-standalone 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18294,6 +18294,29 @@ class pa {
|
|
|
18294
18294
|
getScale() {
|
|
18295
18295
|
return this.currentScale;
|
|
18296
18296
|
}
|
|
18297
|
+
/**
|
|
18298
|
+
* Get dimensions of a specific page in PDF points
|
|
18299
|
+
* @param pageIndex - Zero-based page index
|
|
18300
|
+
* @returns Page dimensions { width: number, height: number } or null if page doesn't exist
|
|
18301
|
+
*/
|
|
18302
|
+
async getPageDimensions(t) {
|
|
18303
|
+
if (!this.pdfDocument)
|
|
18304
|
+
throw new Error("PDF not loaded");
|
|
18305
|
+
if (t < 0 || t >= this.pdfDocument.numPages)
|
|
18306
|
+
return null;
|
|
18307
|
+
const e = this.pageInfo.get(t);
|
|
18308
|
+
if (e)
|
|
18309
|
+
return { width: e.width, height: e.height };
|
|
18310
|
+
try {
|
|
18311
|
+
const s = (await this.pdfDocument.getPage(t + 1)).getViewport({ scale: 1 }), i = {
|
|
18312
|
+
width: s.width,
|
|
18313
|
+
height: s.height
|
|
18314
|
+
};
|
|
18315
|
+
return this.pageInfo.set(t, i), i;
|
|
18316
|
+
} catch (s) {
|
|
18317
|
+
return console.error(`Failed to get dimensions for page ${t}:`, s), null;
|
|
18318
|
+
}
|
|
18319
|
+
}
|
|
18297
18320
|
// Field Management
|
|
18298
18321
|
fields = [];
|
|
18299
18322
|
setFields(t) {
|
|
@@ -18514,6 +18537,9 @@ class ga {
|
|
|
18514
18537
|
getScale() {
|
|
18515
18538
|
return this.viewer.getScale();
|
|
18516
18539
|
}
|
|
18540
|
+
async getPageDimensions(t) {
|
|
18541
|
+
return this.viewer.getPageDimensions(t);
|
|
18542
|
+
}
|
|
18517
18543
|
// Event handling
|
|
18518
18544
|
on(t, e) {
|
|
18519
18545
|
this.viewer.on(t, e);
|