@imggion/html2realpdf 0.1.14 → 0.2.0
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/README.md +15 -2
- package/dist/libhtml2realpdf.wasm +0 -0
- package/dist/preview.d.ts +26 -1
- package/dist/preview.js +170 -13
- package/dist/preview.js.map +1 -1
- package/dist/snapshot.js +44 -25
- package/dist/snapshot.js.map +1 -1
- package/package.json +1 -1
- package/skills/html2realpdf/SKILL.md +10 -1
package/package.json
CHANGED
|
@@ -348,7 +348,7 @@ Pass these options to `PdfDocument.preview`:
|
|
|
348
348
|
|
|
349
349
|
| Option | Values and default |
|
|
350
350
|
| --- | --- |
|
|
351
|
-
| `showToolbar` | `true` by default; set to `false` to hide
|
|
351
|
+
| `showToolbar` | `true` by default; set to `false` to hide page navigation and zoom controls |
|
|
352
352
|
| `padding` | Non-negative CSS pixel value; `28` by default and `16` on narrow screens |
|
|
353
353
|
| `initialScale` | `"fit-width"` (default) or a numeric scale |
|
|
354
354
|
| `minScale` | `0.25` by default, clamped to at least `0.1` |
|
|
@@ -357,6 +357,7 @@ Pass these options to `PdfDocument.preview`:
|
|
|
357
357
|
| `maxPixelRatio` | `2` by default; caps page-canvas device pixel ratio |
|
|
358
358
|
| `ariaLabel` | `"PDF preview"` by default |
|
|
359
359
|
| `onProgress` | Callback after each page canvas completes |
|
|
360
|
+
| `onPageChange` | Callback after initial loading and whenever the 1-based current page changes |
|
|
360
361
|
|
|
361
362
|
### html2pdf.js compatibility options
|
|
362
363
|
|
|
@@ -421,8 +422,16 @@ all previews it owns.
|
|
|
421
422
|
```ts
|
|
422
423
|
const preview = await pdf.preview(document.querySelector("#preview")!, {
|
|
423
424
|
initialScale: "fit-width",
|
|
425
|
+
onPageChange(currentPage, totalPages) {
|
|
426
|
+
document.querySelector("#page-count")!.textContent = `Page ${currentPage} of ${totalPages}`;
|
|
427
|
+
},
|
|
424
428
|
});
|
|
425
429
|
|
|
430
|
+
document.querySelector("#previous")!.addEventListener("click", () => preview.previousPage());
|
|
431
|
+
document.querySelector("#next")!.addEventListener("click", () => preview.nextPage());
|
|
432
|
+
preview.goToPage(7); // Clamped to the first or last page when outside the document range.
|
|
433
|
+
console.log(preview.currentPage);
|
|
434
|
+
|
|
426
435
|
preview.dispose();
|
|
427
436
|
pdf.dispose();
|
|
428
437
|
```
|