@imggion/html2realpdf 0.1.1 → 0.1.14-rc1
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 +12 -1
- package/dist/errors.js +8 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/libhtml2realpdf.wasm +0 -0
- package/dist/preview.d.ts +13 -0
- package/dist/preview.js +84 -13
- package/dist/preview.js.map +1 -1
- package/dist/snapshot.js +40 -6
- package/dist/snapshot.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/skills/html2realpdf/SKILL.md +2 -0
package/dist/types.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export interface RenderOptions {
|
|
|
202
202
|
pageBreak?: PageBreakRules;
|
|
203
203
|
/** PDF information dictionary fields. */
|
|
204
204
|
metadata?: PdfMetadata;
|
|
205
|
-
/** Preserves
|
|
205
|
+
/** Preserves HTTP(S), mail, telephone, and FTP annotations unless explicitly set to `false`. */
|
|
206
206
|
enableLinks?: boolean;
|
|
207
207
|
/**
|
|
208
208
|
* Rejects the caller at snapshot and render boundaries when aborted.
|
|
@@ -258,7 +258,7 @@ export interface Html2PdfOptions {
|
|
|
258
258
|
margin?: Margin;
|
|
259
259
|
/** Filename used by `save` when no method argument is supplied. */
|
|
260
260
|
filename?: string;
|
|
261
|
-
/** Preserves links unless explicitly disabled. */
|
|
261
|
+
/** Preserves HTTP(S), mail, telephone, and FTP links unless explicitly disabled. */
|
|
262
262
|
enableLinks?: boolean;
|
|
263
263
|
/** Compatibility pagination rules. */
|
|
264
264
|
pagebreak?: CompatPageBreakOptions;
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * Public configuration and callback contracts for the browser wrapper.\n *\n * @packageDocumentation\n */\n\n/** A structural ref accepted without making React a runtime dependency. */\nexport type RefLike<T> = { readonly current: T | null };\n\n/**\n * Input accepted by the snapshot boundary.\n *\n * @remarks\n * Mounted elements and refs preserve computed styles and live browser state;\n * strings are evaluated in an inert document.\n */\nexport type HtmlSource = string | Element | RefLike<Element>;\n\n/** Units used for custom page dimensions and margins. */\nexport type LengthUnit = \"pt\" | \"px\" | \"mm\" | \"cm\" | \"in\";\n\n/** Named physical page sizes or a custom `[width, height]` in the selected unit. */\nexport type PageFormat = \"a4\" | \"letter\" | readonly [width: number, height: number];\n\n/** Orientation applied after resolving the page format. */\nexport type PageOrientation = \"portrait\" | \"landscape\";\n\n/**\n * Layout and CSS support profile.\n *\n * @remarks\n * `document` favors stable paged reports. `web` enables the broader browser\n * layout profile. `strict` uses that broader profile and rejects unsupported\n * CSS by default.\n */\nexport type CssProfile = \"document\" | \"web\" | \"strict\";\n\n/** Media environment used while resolving styles and media queries. */\nexport type MediaType = \"screen\" | \"print\";\n\n/** Containing block used for the snapshotted root element. */\nexport type LayoutContext = \"source\" | \"page\";\n\n/** Action taken when an authored CSS property is outside the selected profile. */\nexport type UnsupportedCssPolicy = \"warn\" | \"error\" | \"ignore\";\n\n/** Policy for SVG subtrees that cannot remain native PDF vectors. */\nexport type FallbackPolicy = \"error\" | \"rasterize-subtree\";\n\n/** Policy used when a canvas-to-SVG adapter intentionally returns `null`. */\nexport type CanvasFallbackPolicy = \"error\" | \"rasterize\";\n\n/** Complete SVG returned by a canvas adapter. */\nexport type CanvasSvgSource = string | Blob | SVGSVGElement;\n\n/** Context passed to a canvas-to-SVG adapter. */\nexport interface CanvasToSvgRequest {\n /** Original live canvas, suitable for chart-library export APIs. */\n canvas: HTMLCanvasElement;\n /** Stable snapshot path used to identify failures and fallbacks. */\n nodePath: string;\n /** Rendered canvas width in CSS pixels. */\n cssWidth: number;\n /** Rendered canvas height in CSS pixels. */\n cssHeight: number;\n /** Backing bitmap width. */\n bitmapWidth: number;\n /** Backing bitmap height. */\n bitmapHeight: number;\n}\n\n/**\n * Replaces a live canvas with vector SVG when the source library can export it.\n *\n * @remarks\n * Returning `null` delegates to `canvasFallback`. Throwing or returning\n * malformed SVG produces `CanvasToSvgError`.\n */\nexport type CanvasToSvg = (\n request: CanvasToSvgRequest,\n) => CanvasSvgSource | null | Promise<CanvasSvgSource | null>;\n\n/** Deterministic viewport used for responsive layout and media queries. */\nexport interface ViewportOptions {\n /** Viewport width in CSS pixels. Values below one are clamped. */\n width: number;\n /** Viewport height in CSS pixels. Values below one are clamped. */\n height: number;\n}\n\n/**\n * Page margins in the selected page unit.\n *\n * @remarks\n * Four values use html2pdf.js order `[top, left, bottom, right]`, not CSS\n * shorthand order. Two values mean `[vertical, horizontal]`.\n */\nexport type Margin =\n | number\n | readonly [vertical: number, horizontal: number]\n | readonly [top: number, left: number, bottom: number, right: number];\n\n/** Explicit page geometry. Supplying this overrides captured `@page` geometry. */\nexport interface PageOptions {\n /** Page size. Defaults to `a4`. */\n format?: PageFormat;\n /** Page orientation. Defaults to `portrait`. */\n orientation?: PageOrientation;\n /** Unit for custom dimensions and margins. Defaults to `pt`. */\n unit?: LengthUnit;\n /** Page margins. Defaults to zero on every edge. */\n margin?: Margin;\n}\n\n/** Coarse rendering phases reported at stable cancellation boundaries. */\nexport type RenderPhase = \"snapshot\" | \"wasm\" | \"complete\";\n\n/** Progress notification for a rendering phase. */\nexport interface RenderProgress {\n /** Phase producing this notification. */\n phase: RenderPhase;\n /** Completed work units within the phase. */\n completed: number;\n /** Total work units within the phase. */\n total: number;\n}\n\n/** Structured warning or error produced without losing successful PDF output. */\nexport interface Diagnostic {\n /** Stable machine-readable identifier. */\n code: string;\n /** Diagnostic severity assigned by the snapshot or native renderer. */\n severity: \"warning\" | \"error\";\n /** Human-readable explanation. */\n message: string;\n /** CSS property associated with the diagnostic, when applicable. */\n property?: string;\n /** Stable snapshot path to the affected node, when available. */\n nodePath?: string;\n /** Pipeline phase that produced the diagnostic. */\n phase?: \"snapshot\" | \"parse\" | \"cascade\" | \"computed\" | \"layout\" | \"fragmentation\" | \"paint\" | \"pdf\";\n /** Fallback that preserved output despite the unsupported input. */\n fallback?: string;\n}\n\n/** Resource requested while materializing a self-contained snapshot. */\nexport interface ResourceRequest {\n /** Resource class. Fonts are registered on `createRenderer` instead. */\n kind: \"image\" | \"stylesheet\";\n /** Absolute URL resolved against `baseUrl` or the source document. */\n url: URL;\n}\n\n/**\n * Resolves resources that cannot be fetched directly by the browser snapshot.\n *\n * @remarks\n * For stylesheets, a string is CSS source. For images, a string is a data URL\n * or replacement URL. `null` leaves the request unresolved and applies\n * `resourcePolicy`.\n */\nexport type ResourceResolver = (request: ResourceRequest) => Blob | string | null | Promise<Blob | string | null>;\n\n/** Selector-driven pagination overrides compatible with html2pdf.js workflows. */\nexport interface PageBreakRules {\n /** Selectors forced to begin on a new page. */\n before?: string | readonly string[];\n /** Selectors forced to end the current page. */\n after?: string | readonly string[];\n /** Selectors whose contents should avoid internal fragmentation. */\n avoid?: string | readonly string[];\n /** Applies `break-inside: avoid` to every element. */\n avoidAll?: boolean;\n /** Honors the legacy `.html2pdf__page-break` marker. */\n legacy?: boolean;\n}\n\n/** PDF information dictionary fields written by the native renderer. */\nexport interface PdfMetadata {\n /** Document title. */\n title?: string;\n /** Document author. */\n author?: string;\n /** Document subject. */\n subject?: string;\n /** Search keywords, joined when supplied as an array. */\n keywords?: string | readonly string[];\n /** Application or service that created the document. */\n creator?: string;\n}\n\n/** Options applied to one HTML snapshot and PDF render. */\nexport interface RenderOptions {\n /** Explicit page geometry; captured `@page` rules are used when omitted. */\n page?: PageOptions;\n /**\n * Promotes unsupported snapshot CSS to errors without selecting the `web`\n * layout profile. An explicit `unsupportedCss` policy takes precedence.\n */\n strict?: boolean;\n /** Layout profile. Defaults to `document`. */\n cssProfile?: CssProfile;\n /** Media environment used for style resolution. Defaults to `screen`. */\n mediaType?: MediaType;\n /**\n * Root layout context. `source` preserves the mounted browser width;\n * `page` resolves an implicit root width and auto inline margins against the\n * PDF content box. Defaults to `source`.\n */\n layoutContext?: LayoutContext;\n /** Isolated viewport used for media queries and responsive layout. */\n viewport?: ViewportOptions;\n /** Unsupported-CSS policy; defaults to `error` for strict mode and `warn` otherwise. */\n unsupportedCss?: UnsupportedCssPolicy;\n /** Unsupported SVG policy. Defaults to `error`. */\n fallback?: FallbackPolicy;\n /** Optional bridge from live canvas content to validated SVG. */\n canvasToSvg?: CanvasToSvg;\n /** Fallback when `canvasToSvg` returns `null`. Defaults to `error`. */\n canvasFallback?: CanvasFallbackPolicy;\n /** Flattens open Shadow DOM into the snapshot. Defaults to `false`. */\n includeShadowDom?: boolean;\n /** Base URL for relative resources. Defaults to the source document URL. */\n baseUrl?: string | URL;\n /** Failed-resource policy. Defaults to `error`. */\n resourcePolicy?: \"error\" | \"omit\";\n /** Resolver for protected, virtual, or otherwise unavailable resources. */\n resourceResolver?: ResourceResolver;\n /** Selector-driven page-break overrides. */\n pageBreak?: PageBreakRules;\n /** PDF information dictionary fields. */\n metadata?: PdfMetadata;\n /** Preserves PDF link annotations unless explicitly set to `false`. */\n enableLinks?: boolean;\n /**\n * Rejects the caller at snapshot and render boundaries when aborted.\n * An already-running synchronous WASM render cannot be preempted.\n */\n signal?: AbortSignal;\n /** Receives coarse phase-boundary progress, not per-page render progress. */\n onProgress?: (progress: RenderProgress) => void;\n}\n\n/** Configuration whose lifetime matches an explicit renderer instance. */\nexport interface RendererInit {\n /** Execution backend. Defaults to `worker`. */\n execution?: \"worker\" | \"main\";\n /** WASM asset override for deployments that cannot serve package-relative assets. */\n wasmUrl?: string | URL;\n /** Embeddable TrueType fonts registered once for every render. */\n fonts?: readonly FontRegistration[];\n}\n\n/** Embeddable TrueType font registered in a renderer-owned WASM context. */\nexport interface FontRegistration {\n /** CSS family name used during font resolution. */\n family: string;\n /** Complete TrueType font bytes, copied into the native context. */\n data: ArrayBuffer | Uint8Array;\n /** CSS font weight. Defaults to `400`. */\n weight?: number | \"normal\" | \"bold\";\n /** CSS font style. Defaults to `normal`. */\n style?: \"normal\" | \"italic\";\n}\n\n/** Page settings accepted through the html2pdf.js-compatible `jsPDF` option. */\nexport interface CompatJsPdfOptions {\n /** Unit shared by custom page geometry and margins. */\n unit?: LengthUnit;\n /** Named or custom page format forwarded to the modern page contract. */\n format?: PageFormat;\n /** Page orientation forwarded to the modern page contract. */\n orientation?: PageOrientation;\n}\n\n/** Page-break settings accepted by the html2pdf.js compatibility layer. */\nexport interface CompatPageBreakOptions {\n /** Compatibility modes. Defaults to `css` and `legacy`. */\n mode?: \"css\" | \"legacy\" | \"avoid-all\" | readonly (\"css\" | \"legacy\" | \"avoid-all\")[];\n /** Selectors forced to begin on a new page. */\n before?: string | readonly string[];\n /** Selectors forced to end the current page. */\n after?: string | readonly string[];\n /** Selectors whose contents should avoid internal fragmentation. */\n avoid?: string | readonly string[];\n}\n\n/** Options supported by the PDF-oriented html2pdf.js compatibility layer. */\nexport interface Html2PdfOptions {\n /** Page margins in html2pdf.js order. */\n margin?: Margin;\n /** Filename used by `save` when no method argument is supplied. */\n filename?: string;\n /** Preserves links unless explicitly disabled. */\n enableLinks?: boolean;\n /** Compatibility pagination rules. */\n pagebreak?: CompatPageBreakOptions;\n /** Compatibility page geometry. */\n jsPDF?: CompatJsPdfOptions;\n /** Unsupported because this renderer does not use an html2canvas pipeline. */\n html2canvas?: never;\n /** Unsupported because PDF pages are not encoded as raster images. */\n image?: never;\n}\n\n/** Output encodings supported by compatibility `output` methods. */\nexport type PdfOutputType =\n | \"arraybuffer\"\n | \"blob\"\n | \"bloburl\"\n | \"bloburi\"\n | \"datauristring\"\n | \"dataurlstring\";\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * Public configuration and callback contracts for the browser wrapper.\n *\n * @packageDocumentation\n */\n\n/** A structural ref accepted without making React a runtime dependency. */\nexport type RefLike<T> = { readonly current: T | null };\n\n/**\n * Input accepted by the snapshot boundary.\n *\n * @remarks\n * Mounted elements and refs preserve computed styles and live browser state;\n * strings are evaluated in an inert document.\n */\nexport type HtmlSource = string | Element | RefLike<Element>;\n\n/** Units used for custom page dimensions and margins. */\nexport type LengthUnit = \"pt\" | \"px\" | \"mm\" | \"cm\" | \"in\";\n\n/** Named physical page sizes or a custom `[width, height]` in the selected unit. */\nexport type PageFormat = \"a4\" | \"letter\" | readonly [width: number, height: number];\n\n/** Orientation applied after resolving the page format. */\nexport type PageOrientation = \"portrait\" | \"landscape\";\n\n/**\n * Layout and CSS support profile.\n *\n * @remarks\n * `document` favors stable paged reports. `web` enables the broader browser\n * layout profile. `strict` uses that broader profile and rejects unsupported\n * CSS by default.\n */\nexport type CssProfile = \"document\" | \"web\" | \"strict\";\n\n/** Media environment used while resolving styles and media queries. */\nexport type MediaType = \"screen\" | \"print\";\n\n/** Containing block used for the snapshotted root element. */\nexport type LayoutContext = \"source\" | \"page\";\n\n/** Action taken when an authored CSS property is outside the selected profile. */\nexport type UnsupportedCssPolicy = \"warn\" | \"error\" | \"ignore\";\n\n/** Policy for SVG subtrees that cannot remain native PDF vectors. */\nexport type FallbackPolicy = \"error\" | \"rasterize-subtree\";\n\n/** Policy used when a canvas-to-SVG adapter intentionally returns `null`. */\nexport type CanvasFallbackPolicy = \"error\" | \"rasterize\";\n\n/** Complete SVG returned by a canvas adapter. */\nexport type CanvasSvgSource = string | Blob | SVGSVGElement;\n\n/** Context passed to a canvas-to-SVG adapter. */\nexport interface CanvasToSvgRequest {\n /** Original live canvas, suitable for chart-library export APIs. */\n canvas: HTMLCanvasElement;\n /** Stable snapshot path used to identify failures and fallbacks. */\n nodePath: string;\n /** Rendered canvas width in CSS pixels. */\n cssWidth: number;\n /** Rendered canvas height in CSS pixels. */\n cssHeight: number;\n /** Backing bitmap width. */\n bitmapWidth: number;\n /** Backing bitmap height. */\n bitmapHeight: number;\n}\n\n/**\n * Replaces a live canvas with vector SVG when the source library can export it.\n *\n * @remarks\n * Returning `null` delegates to `canvasFallback`. Throwing or returning\n * malformed SVG produces `CanvasToSvgError`.\n */\nexport type CanvasToSvg = (\n request: CanvasToSvgRequest,\n) => CanvasSvgSource | null | Promise<CanvasSvgSource | null>;\n\n/** Deterministic viewport used for responsive layout and media queries. */\nexport interface ViewportOptions {\n /** Viewport width in CSS pixels. Values below one are clamped. */\n width: number;\n /** Viewport height in CSS pixels. Values below one are clamped. */\n height: number;\n}\n\n/**\n * Page margins in the selected page unit.\n *\n * @remarks\n * Four values use html2pdf.js order `[top, left, bottom, right]`, not CSS\n * shorthand order. Two values mean `[vertical, horizontal]`.\n */\nexport type Margin =\n | number\n | readonly [vertical: number, horizontal: number]\n | readonly [top: number, left: number, bottom: number, right: number];\n\n/** Explicit page geometry. Supplying this overrides captured `@page` geometry. */\nexport interface PageOptions {\n /** Page size. Defaults to `a4`. */\n format?: PageFormat;\n /** Page orientation. Defaults to `portrait`. */\n orientation?: PageOrientation;\n /** Unit for custom dimensions and margins. Defaults to `pt`. */\n unit?: LengthUnit;\n /** Page margins. Defaults to zero on every edge. */\n margin?: Margin;\n}\n\n/** Coarse rendering phases reported at stable cancellation boundaries. */\nexport type RenderPhase = \"snapshot\" | \"wasm\" | \"complete\";\n\n/** Progress notification for a rendering phase. */\nexport interface RenderProgress {\n /** Phase producing this notification. */\n phase: RenderPhase;\n /** Completed work units within the phase. */\n completed: number;\n /** Total work units within the phase. */\n total: number;\n}\n\n/** Structured warning or error produced without losing successful PDF output. */\nexport interface Diagnostic {\n /** Stable machine-readable identifier. */\n code: string;\n /** Diagnostic severity assigned by the snapshot or native renderer. */\n severity: \"warning\" | \"error\";\n /** Human-readable explanation. */\n message: string;\n /** CSS property associated with the diagnostic, when applicable. */\n property?: string;\n /** Stable snapshot path to the affected node, when available. */\n nodePath?: string;\n /** Pipeline phase that produced the diagnostic. */\n phase?: \"snapshot\" | \"parse\" | \"cascade\" | \"computed\" | \"layout\" | \"fragmentation\" | \"paint\" | \"pdf\";\n /** Fallback that preserved output despite the unsupported input. */\n fallback?: string;\n}\n\n/** Resource requested while materializing a self-contained snapshot. */\nexport interface ResourceRequest {\n /** Resource class. Fonts are registered on `createRenderer` instead. */\n kind: \"image\" | \"stylesheet\";\n /** Absolute URL resolved against `baseUrl` or the source document. */\n url: URL;\n}\n\n/**\n * Resolves resources that cannot be fetched directly by the browser snapshot.\n *\n * @remarks\n * For stylesheets, a string is CSS source. For images, a string is a data URL\n * or replacement URL. `null` leaves the request unresolved and applies\n * `resourcePolicy`.\n */\nexport type ResourceResolver = (request: ResourceRequest) => Blob | string | null | Promise<Blob | string | null>;\n\n/** Selector-driven pagination overrides compatible with html2pdf.js workflows. */\nexport interface PageBreakRules {\n /** Selectors forced to begin on a new page. */\n before?: string | readonly string[];\n /** Selectors forced to end the current page. */\n after?: string | readonly string[];\n /** Selectors whose contents should avoid internal fragmentation. */\n avoid?: string | readonly string[];\n /** Applies `break-inside: avoid` to every element. */\n avoidAll?: boolean;\n /** Honors the legacy `.html2pdf__page-break` marker. */\n legacy?: boolean;\n}\n\n/** PDF information dictionary fields written by the native renderer. */\nexport interface PdfMetadata {\n /** Document title. */\n title?: string;\n /** Document author. */\n author?: string;\n /** Document subject. */\n subject?: string;\n /** Search keywords, joined when supplied as an array. */\n keywords?: string | readonly string[];\n /** Application or service that created the document. */\n creator?: string;\n}\n\n/** Options applied to one HTML snapshot and PDF render. */\nexport interface RenderOptions {\n /** Explicit page geometry; captured `@page` rules are used when omitted. */\n page?: PageOptions;\n /**\n * Promotes unsupported snapshot CSS to errors without selecting the `web`\n * layout profile. An explicit `unsupportedCss` policy takes precedence.\n */\n strict?: boolean;\n /** Layout profile. Defaults to `document`. */\n cssProfile?: CssProfile;\n /** Media environment used for style resolution. Defaults to `screen`. */\n mediaType?: MediaType;\n /**\n * Root layout context. `source` preserves the mounted browser width;\n * `page` resolves an implicit root width and auto inline margins against the\n * PDF content box. Defaults to `source`.\n */\n layoutContext?: LayoutContext;\n /** Isolated viewport used for media queries and responsive layout. */\n viewport?: ViewportOptions;\n /** Unsupported-CSS policy; defaults to `error` for strict mode and `warn` otherwise. */\n unsupportedCss?: UnsupportedCssPolicy;\n /** Unsupported SVG policy. Defaults to `error`. */\n fallback?: FallbackPolicy;\n /** Optional bridge from live canvas content to validated SVG. */\n canvasToSvg?: CanvasToSvg;\n /** Fallback when `canvasToSvg` returns `null`. Defaults to `error`. */\n canvasFallback?: CanvasFallbackPolicy;\n /** Flattens open Shadow DOM into the snapshot. Defaults to `false`. */\n includeShadowDom?: boolean;\n /** Base URL for relative resources. Defaults to the source document URL. */\n baseUrl?: string | URL;\n /** Failed-resource policy. Defaults to `error`. */\n resourcePolicy?: \"error\" | \"omit\";\n /** Resolver for protected, virtual, or otherwise unavailable resources. */\n resourceResolver?: ResourceResolver;\n /** Selector-driven page-break overrides. */\n pageBreak?: PageBreakRules;\n /** PDF information dictionary fields. */\n metadata?: PdfMetadata;\n /** Preserves HTTP(S), mail, telephone, and FTP annotations unless explicitly set to `false`. */\n enableLinks?: boolean;\n /**\n * Rejects the caller at snapshot and render boundaries when aborted.\n * An already-running synchronous WASM render cannot be preempted.\n */\n signal?: AbortSignal;\n /** Receives coarse phase-boundary progress, not per-page render progress. */\n onProgress?: (progress: RenderProgress) => void;\n}\n\n/** Configuration whose lifetime matches an explicit renderer instance. */\nexport interface RendererInit {\n /** Execution backend. Defaults to `worker`. */\n execution?: \"worker\" | \"main\";\n /** WASM asset override for deployments that cannot serve package-relative assets. */\n wasmUrl?: string | URL;\n /** Embeddable TrueType fonts registered once for every render. */\n fonts?: readonly FontRegistration[];\n}\n\n/** Embeddable TrueType font registered in a renderer-owned WASM context. */\nexport interface FontRegistration {\n /** CSS family name used during font resolution. */\n family: string;\n /** Complete TrueType font bytes, copied into the native context. */\n data: ArrayBuffer | Uint8Array;\n /** CSS font weight. Defaults to `400`. */\n weight?: number | \"normal\" | \"bold\";\n /** CSS font style. Defaults to `normal`. */\n style?: \"normal\" | \"italic\";\n}\n\n/** Page settings accepted through the html2pdf.js-compatible `jsPDF` option. */\nexport interface CompatJsPdfOptions {\n /** Unit shared by custom page geometry and margins. */\n unit?: LengthUnit;\n /** Named or custom page format forwarded to the modern page contract. */\n format?: PageFormat;\n /** Page orientation forwarded to the modern page contract. */\n orientation?: PageOrientation;\n}\n\n/** Page-break settings accepted by the html2pdf.js compatibility layer. */\nexport interface CompatPageBreakOptions {\n /** Compatibility modes. Defaults to `css` and `legacy`. */\n mode?: \"css\" | \"legacy\" | \"avoid-all\" | readonly (\"css\" | \"legacy\" | \"avoid-all\")[];\n /** Selectors forced to begin on a new page. */\n before?: string | readonly string[];\n /** Selectors forced to end the current page. */\n after?: string | readonly string[];\n /** Selectors whose contents should avoid internal fragmentation. */\n avoid?: string | readonly string[];\n}\n\n/** Options supported by the PDF-oriented html2pdf.js compatibility layer. */\nexport interface Html2PdfOptions {\n /** Page margins in html2pdf.js order. */\n margin?: Margin;\n /** Filename used by `save` when no method argument is supplied. */\n filename?: string;\n /** Preserves HTTP(S), mail, telephone, and FTP links unless explicitly disabled. */\n enableLinks?: boolean;\n /** Compatibility pagination rules. */\n pagebreak?: CompatPageBreakOptions;\n /** Compatibility page geometry. */\n jsPDF?: CompatJsPdfOptions;\n /** Unsupported because this renderer does not use an html2canvas pipeline. */\n html2canvas?: never;\n /** Unsupported because PDF pages are not encoded as raster images. */\n image?: never;\n}\n\n/** Output encodings supported by compatibility `output` methods. */\nexport type PdfOutputType =\n | \"arraybuffer\"\n | \"blob\"\n | \"bloburl\"\n | \"bloburi\"\n | \"datauristring\"\n | \"dataurlstring\";\n"]}
|
package/package.json
CHANGED
|
@@ -114,6 +114,8 @@ Pass these options to `PdfDocument.preview`:
|
|
|
114
114
|
|
|
115
115
|
| Option | Values and default |
|
|
116
116
|
| --- | --- |
|
|
117
|
+
| `showToolbar` | `true` by default; set to `false` to hide the summary and zoom controls |
|
|
118
|
+
| `padding` | Non-negative CSS pixel value; `28` by default and `16` on narrow screens |
|
|
117
119
|
| `initialScale` | `"fit-width"` (default) or a numeric scale |
|
|
118
120
|
| `minScale` | `0.25` by default, clamped to at least `0.1` |
|
|
119
121
|
| `maxScale` | `3` by default, clamped to at least `minScale` |
|