@imggion/html2realpdf 0.1.14-rc2 → 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 +24 -12
package/package.json
CHANGED
|
@@ -197,11 +197,7 @@ consistent across every row.
|
|
|
197
197
|
|
|
198
198
|
```css
|
|
199
199
|
.pdf-table-frame { border: 0.3mm solid #d8dee9; border-radius: 3mm; }
|
|
200
|
-
.pdf-table {
|
|
201
|
-
width: 100%;
|
|
202
|
-
border-collapse: collapse;
|
|
203
|
-
table-layout: fixed;
|
|
204
|
-
}
|
|
200
|
+
.pdf-table { width: 100%; border-collapse: separate; border-spacing: 0; }
|
|
205
201
|
.pdf-col-label { width: 26%; }
|
|
206
202
|
.pdf-col-indicator { width: 24mm; }
|
|
207
203
|
.pdf-table th, .pdf-table td {
|
|
@@ -211,21 +207,28 @@ consistent across every row.
|
|
|
211
207
|
vertical-align: top;
|
|
212
208
|
overflow-wrap: anywhere;
|
|
213
209
|
}
|
|
210
|
+
.pdf-table thead th { background-color: #172b4d; color: #fff; }
|
|
211
|
+
.pdf-table thead th:first-child { border-top-left-radius: 2.7mm; }
|
|
212
|
+
.pdf-table thead th:last-child { border-top-right-radius: 2.7mm; }
|
|
214
213
|
.pdf-table thead, .pdf-table tr {
|
|
215
214
|
break-inside: avoid;
|
|
216
215
|
page-break-inside: avoid;
|
|
217
216
|
}
|
|
218
|
-
.pdf-table tbody tr:nth-child(odd) { background-color:
|
|
219
|
-
.pdf-table tbody tr:nth-child(even) { background-color: #f7f9fc; }
|
|
217
|
+
.pdf-table tbody tr:nth-child(odd) > * { background-color: transparent; }
|
|
218
|
+
.pdf-table tbody tr:nth-child(even) > * { background-color: #f7f9fc; }
|
|
220
219
|
.pdf-indicator-cell { text-align: right; white-space: nowrap; }
|
|
221
220
|
```
|
|
222
221
|
|
|
222
|
+
Declare tracks through `<colgroup>`; `table-layout: fixed` is not supported and may be diagnosed.
|
|
223
|
+
Apply header backgrounds and radii to `<th>` cells: a parent radius does not clip descendants
|
|
224
|
+
without `overflow: hidden`, which conflicts with fragmented tables; cell radii repeat with `thead`.
|
|
225
|
+
|
|
223
226
|
Let the table and `tbody` fragment while keeping individual rows intact. Add
|
|
224
227
|
`.pdf-atomic` to the frame only when the application can prove the complete
|
|
225
228
|
table fits on one page, using measured or bounded row heights. For long tables,
|
|
226
229
|
do not set `overflow: hidden` on the frame; clipping conflicts with
|
|
227
|
-
fragmentation.
|
|
228
|
-
|
|
230
|
+
fragmentation. Transparent rows must retain painted-row geometry; if a background
|
|
231
|
+
changes cell width or alignment, treat it as a renderer regression, not a workaround.
|
|
229
232
|
|
|
230
233
|
### Align legends, badges, and indicators
|
|
231
234
|
|
|
@@ -271,8 +274,8 @@ and transforms such as `translateY`.
|
|
|
271
274
|
- Confirm text selection, links, and embedded fonts in the generated PDF.
|
|
272
275
|
- Test empty, short, and long data, including a table that spans pages and a
|
|
273
276
|
paragraph or list crossing a page boundary.
|
|
274
|
-
-
|
|
275
|
-
|
|
277
|
+
- Test `break-before: page` at page start with no extra blank; inspect every table page for one
|
|
278
|
+
repeated header, stable tracks, matching radii, preserved borders, and indicator alignment.
|
|
276
279
|
- Render with the same viewport, media type, fonts, and chart export strategy
|
|
277
280
|
used in production.
|
|
278
281
|
|
|
@@ -345,7 +348,7 @@ Pass these options to `PdfDocument.preview`:
|
|
|
345
348
|
|
|
346
349
|
| Option | Values and default |
|
|
347
350
|
| --- | --- |
|
|
348
|
-
| `showToolbar` | `true` by default; set to `false` to hide
|
|
351
|
+
| `showToolbar` | `true` by default; set to `false` to hide page navigation and zoom controls |
|
|
349
352
|
| `padding` | Non-negative CSS pixel value; `28` by default and `16` on narrow screens |
|
|
350
353
|
| `initialScale` | `"fit-width"` (default) or a numeric scale |
|
|
351
354
|
| `minScale` | `0.25` by default, clamped to at least `0.1` |
|
|
@@ -354,6 +357,7 @@ Pass these options to `PdfDocument.preview`:
|
|
|
354
357
|
| `maxPixelRatio` | `2` by default; caps page-canvas device pixel ratio |
|
|
355
358
|
| `ariaLabel` | `"PDF preview"` by default |
|
|
356
359
|
| `onProgress` | Callback after each page canvas completes |
|
|
360
|
+
| `onPageChange` | Callback after initial loading and whenever the 1-based current page changes |
|
|
357
361
|
|
|
358
362
|
### html2pdf.js compatibility options
|
|
359
363
|
|
|
@@ -418,8 +422,16 @@ all previews it owns.
|
|
|
418
422
|
```ts
|
|
419
423
|
const preview = await pdf.preview(document.querySelector("#preview")!, {
|
|
420
424
|
initialScale: "fit-width",
|
|
425
|
+
onPageChange(currentPage, totalPages) {
|
|
426
|
+
document.querySelector("#page-count")!.textContent = `Page ${currentPage} of ${totalPages}`;
|
|
427
|
+
},
|
|
421
428
|
});
|
|
422
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
|
+
|
|
423
435
|
preview.dispose();
|
|
424
436
|
pdf.dispose();
|
|
425
437
|
```
|