takumi-pdf 0.13.1 → 0.14.1
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/bundlers/browser.mjs +7 -0
- package/bundlers/vite.mjs +1 -1
- package/dist/export.d.cts +17 -1
- package/dist/export.d.mts +17 -1
- package/package.json +7 -3
- package/pkg/takumi_pdf_wasm_bg.wasm +0 -0
package/bundlers/vite.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import * as wasm from "../dist/export.mjs";
|
|
|
5
5
|
// importing server chunk, so resolve relative to import.meta.url, not the framework output dir.
|
|
6
6
|
async function resolveWasm() {
|
|
7
7
|
if (typeof process !== "undefined" && process.versions?.node != null) {
|
|
8
|
-
const { readFile } =
|
|
8
|
+
const { readFile } = process.getBuiltinModule("node:fs/promises");
|
|
9
9
|
const path = decodeURIComponent(url.replace(/[?#].*$/, ""));
|
|
10
10
|
|
|
11
11
|
// Dev SSR serves an `/@fs/<abs-path>` URL.
|
package/dist/export.d.cts
CHANGED
|
@@ -72,6 +72,14 @@ type PageMargin = PageMarginSide | {
|
|
|
72
72
|
bottom?: PageMarginSide;
|
|
73
73
|
left?: PageMarginSide;
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* A page to keep: a 1-based page number, or an inclusive span. An unset `from`
|
|
77
|
+
* starts at the first page; an unset `to` runs to the last.
|
|
78
|
+
*/
|
|
79
|
+
type PageRange = number | {
|
|
80
|
+
from?: number;
|
|
81
|
+
to?: number;
|
|
82
|
+
};
|
|
75
83
|
/**
|
|
76
84
|
* Paged output (the default): content flows across pages of `size`, like
|
|
77
85
|
* Puppeteer's `page.pdf()`. The layout canvas has unbounded height, so
|
|
@@ -95,6 +103,13 @@ type PagedOptions = {
|
|
|
95
103
|
header?: NodeInput;
|
|
96
104
|
/** Band repeated at the bottom of every page; same class hooks as `header`. */
|
|
97
105
|
footer?: NodeInput;
|
|
106
|
+
/**
|
|
107
|
+
* The pages the output keeps, e.g. `[1, { from: 4, to: 8 }]`, like a print
|
|
108
|
+
* dialog's page ranges. Layout and page counters still run over the whole
|
|
109
|
+
* document, so a kept page shows the numbers it would in full output.
|
|
110
|
+
* Ranges that keep no page reject the render.
|
|
111
|
+
*/
|
|
112
|
+
pageRanges?: PageRange[];
|
|
98
113
|
};
|
|
99
114
|
/**
|
|
100
115
|
* Single-page output: a fixed viewport, like an image render. Percentage
|
|
@@ -109,6 +124,7 @@ type ViewportOptions = {
|
|
|
109
124
|
margin?: never;
|
|
110
125
|
header?: never;
|
|
111
126
|
footer?: never;
|
|
127
|
+
pageRanges?: never;
|
|
112
128
|
};
|
|
113
129
|
/**
|
|
114
130
|
* Options for {@link PdfRenderer.measure}: page geometry (or a viewport) plus
|
|
@@ -316,4 +332,4 @@ declare function render(node: NodeInput, options?: RenderOptions): Promise<Uint8
|
|
|
316
332
|
/** Measures with a lazily created shared {@link PdfRenderer}. */
|
|
317
333
|
declare function measure(node: NodeInput, options?: MeasureOptions): Promise<MeasuredSize>;
|
|
318
334
|
//#endregion
|
|
319
|
-
export { ArchivalAttachment, Attachment, type CounterProps, type CounterStyle, Dimensions, type FontLoader, type ImagesInput, MeasureOptions, MeasuredSize, NodeInput, PageMargin, PageMarginSide, PageNumber, PageSize, PageSizeName, PdfMetadata, PdfRenderer, RenderOptions, TargetPageNumber, TotalPages, ViewportInput, XmpProperty, XmpSchema, __wbg_init as default, initSync, measure, render };
|
|
335
|
+
export { ArchivalAttachment, Attachment, type CounterProps, type CounterStyle, Dimensions, type FontLoader, type ImagesInput, MeasureOptions, MeasuredSize, NodeInput, PageMargin, PageMarginSide, PageNumber, PageRange, PageSize, PageSizeName, PdfMetadata, PdfRenderer, RenderOptions, TargetPageNumber, TotalPages, ViewportInput, XmpProperty, XmpSchema, __wbg_init as default, initSync, measure, render };
|
package/dist/export.d.mts
CHANGED
|
@@ -72,6 +72,14 @@ type PageMargin = PageMarginSide | {
|
|
|
72
72
|
bottom?: PageMarginSide;
|
|
73
73
|
left?: PageMarginSide;
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* A page to keep: a 1-based page number, or an inclusive span. An unset `from`
|
|
77
|
+
* starts at the first page; an unset `to` runs to the last.
|
|
78
|
+
*/
|
|
79
|
+
type PageRange = number | {
|
|
80
|
+
from?: number;
|
|
81
|
+
to?: number;
|
|
82
|
+
};
|
|
75
83
|
/**
|
|
76
84
|
* Paged output (the default): content flows across pages of `size`, like
|
|
77
85
|
* Puppeteer's `page.pdf()`. The layout canvas has unbounded height, so
|
|
@@ -95,6 +103,13 @@ type PagedOptions = {
|
|
|
95
103
|
header?: NodeInput;
|
|
96
104
|
/** Band repeated at the bottom of every page; same class hooks as `header`. */
|
|
97
105
|
footer?: NodeInput;
|
|
106
|
+
/**
|
|
107
|
+
* The pages the output keeps, e.g. `[1, { from: 4, to: 8 }]`, like a print
|
|
108
|
+
* dialog's page ranges. Layout and page counters still run over the whole
|
|
109
|
+
* document, so a kept page shows the numbers it would in full output.
|
|
110
|
+
* Ranges that keep no page reject the render.
|
|
111
|
+
*/
|
|
112
|
+
pageRanges?: PageRange[];
|
|
98
113
|
};
|
|
99
114
|
/**
|
|
100
115
|
* Single-page output: a fixed viewport, like an image render. Percentage
|
|
@@ -109,6 +124,7 @@ type ViewportOptions = {
|
|
|
109
124
|
margin?: never;
|
|
110
125
|
header?: never;
|
|
111
126
|
footer?: never;
|
|
127
|
+
pageRanges?: never;
|
|
112
128
|
};
|
|
113
129
|
/**
|
|
114
130
|
* Options for {@link PdfRenderer.measure}: page geometry (or a viewport) plus
|
|
@@ -316,4 +332,4 @@ declare function render(node: NodeInput, options?: RenderOptions): Promise<Uint8
|
|
|
316
332
|
/** Measures with a lazily created shared {@link PdfRenderer}. */
|
|
317
333
|
declare function measure(node: NodeInput, options?: MeasureOptions): Promise<MeasuredSize>;
|
|
318
334
|
//#endregion
|
|
319
|
-
export { ArchivalAttachment, Attachment, type CounterProps, type CounterStyle, Dimensions, type FontLoader, type ImagesInput, MeasureOptions, MeasuredSize, NodeInput, PageMargin, PageMarginSide, PageNumber, PageSize, PageSizeName, PdfMetadata, PdfRenderer, RenderOptions, TargetPageNumber, TotalPages, ViewportInput, XmpProperty, XmpSchema, __wbg_init as default, initSync, measure, render };
|
|
335
|
+
export { ArchivalAttachment, Attachment, type CounterProps, type CounterStyle, Dimensions, type FontLoader, type ImagesInput, MeasureOptions, MeasuredSize, NodeInput, PageMargin, PageMarginSide, PageNumber, PageRange, PageSize, PageSizeName, PdfMetadata, PdfRenderer, RenderOptions, TargetPageNumber, TotalPages, ViewportInput, XmpProperty, XmpSchema, __wbg_init as default, initSync, measure, render };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "takumi-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Render paged PDFs from JSX, HTML, and CSS. No headless browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chromium-free",
|
|
@@ -75,6 +75,10 @@
|
|
|
75
75
|
"default": "./bundlers/vite.mjs"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
+
"browser": {
|
|
79
|
+
"types": "./bundlers/node.d.ts",
|
|
80
|
+
"default": "./bundlers/browser.mjs"
|
|
81
|
+
},
|
|
78
82
|
"module": {
|
|
79
83
|
"types": "./bundlers/node.d.ts",
|
|
80
84
|
"default": "./bundlers/vite.mjs"
|
|
@@ -139,7 +143,7 @@
|
|
|
139
143
|
"publish-lint": "attw --pack . && publint --strict ."
|
|
140
144
|
},
|
|
141
145
|
"dependencies": {
|
|
142
|
-
"@takumi-rs/helpers": "2.13.
|
|
146
|
+
"@takumi-rs/helpers": "2.13.5"
|
|
143
147
|
},
|
|
144
148
|
"devDependencies": {
|
|
145
149
|
"@types/bun": "^1.4.0",
|
|
@@ -155,7 +159,7 @@
|
|
|
155
159
|
}
|
|
156
160
|
},
|
|
157
161
|
"engines": {
|
|
158
|
-
"node": ">=
|
|
162
|
+
"node": ">=20.19"
|
|
159
163
|
},
|
|
160
164
|
"readme": "README.md"
|
|
161
165
|
}
|
|
Binary file
|