@lupinum/nuxt-pdf 0.4.0-beta.3 → 0.4.0-beta.5

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/CONFORMANCE.md +10 -4
  3. package/README.md +28 -0
  4. package/dist/agent/AGENTS.md +48 -0
  5. package/dist/agent/manifest.json +215 -0
  6. package/dist/agent/pages/docs/examples/supported-behavior.md +75 -0
  7. package/dist/agent/pages/docs/examples.md +163 -0
  8. package/dist/agent/pages/docs/getting-started/installation.md +90 -0
  9. package/dist/agent/pages/docs/getting-started/quickstart.md +126 -0
  10. package/dist/agent/pages/docs/getting-started.md +61 -0
  11. package/dist/agent/pages/docs/guides/contents-links-bookmarks.md +123 -0
  12. package/dist/agent/pages/docs/guides/deployment.md +118 -0
  13. package/dist/agent/pages/docs/guides/errors-and-debugging.md +90 -0
  14. package/dist/agent/pages/docs/guides/images-and-fonts.md +102 -0
  15. package/dist/agent/pages/docs/guides/recipes.md +258 -0
  16. package/dist/agent/pages/docs/guides/remote-images.md +72 -0
  17. package/dist/agent/pages/docs/guides/reusable-components.md +81 -0
  18. package/dist/agent/pages/docs/guides/standalone-node.md +107 -0
  19. package/dist/agent/pages/docs/guides/svg-graphics.md +165 -0
  20. package/dist/agent/pages/docs/guides/testing.md +119 -0
  21. package/dist/agent/pages/docs/learn/document-tree.md +91 -0
  22. package/dist/agent/pages/docs/learn/runtime-and-data.md +63 -0
  23. package/dist/agent/pages/docs/learn/styling-and-layout.md +79 -0
  24. package/dist/agent/pages/docs/learn/templates-and-registry.md +96 -0
  25. package/dist/agent/pages/docs/reference/composables.md +55 -0
  26. package/dist/agent/pages/docs/reference/define-pdf.md +96 -0
  27. package/dist/agent/pages/docs/reference/errors-and-limits.md +89 -0
  28. package/dist/agent/pages/docs/reference/module-options.md +104 -0
  29. package/dist/agent/pages/docs/reference/page-sizes.md +54 -0
  30. package/dist/agent/pages/docs/reference/primitives.md +216 -0
  31. package/dist/agent/pages/docs/reference/registry.md +185 -0
  32. package/dist/agent/pages/docs/reference/standalone.md +53 -0
  33. package/dist/agent/pages/docs/reference/styles.md +176 -0
  34. package/dist/agent/pages/docs/reference/test-utilities.md +124 -0
  35. package/dist/build.mjs +2 -2
  36. package/dist/module.json +1 -1
  37. package/dist/module.mjs +14 -11
  38. package/dist/runtime/components/stubs.d.ts +22 -10
  39. package/dist/runtime/components/stubs.js +22 -27
  40. package/dist/runtime/server/assets/resolve-asset.js +2 -40
  41. package/dist/runtime/server/preview.js +1 -1
  42. package/dist/shared/{nuxt-pdf.DMC_Rdsz.mjs → nuxt-pdf.C-E8MM_K.mjs} +1 -0
  43. package/dist/shared/{nuxt-pdf.D3hUPqOJ.mjs → nuxt-pdf.CjVyPF31.mjs} +2 -2
  44. package/dist/test.mjs +1 -1
  45. package/package.json +17 -13
@@ -0,0 +1,96 @@
1
+ ---
2
+ title: "definePdf"
3
+ description: "The compile-time definition for render metadata, development preview data, and the multi-pass limit."
4
+ url: "https://nuxt-pdf.lupinum.com/docs/reference/define-pdf"
5
+ route: "/docs/reference/define-pdf"
6
+ locale: "en"
7
+ section: "Documentation"
8
+ collection: "docs"
9
+ source: "ginko-content"
10
+ ---
11
+
12
+ # definePdf
13
+
14
+ > The compile-time definition for render metadata, development preview data, and the multi-pass limit.
15
+
16
+ Each `pdfs/*.vue` template calls `definePdf` exactly once. It is a compile-time
17
+ macro (like `defineProps`); it declares render metadata and development-only
18
+ preview data and returns nothing.
19
+
20
+ ```ts
21
+ definePdf<Props>({
22
+ title: props => `Report ${props.id}`,
23
+ filename: props => `report-${props.id}.pdf`,
24
+ language: 'en-GB',
25
+ maxPasses: 5,
26
+ sampleData: { id: 'sample' },
27
+ scenarios: {
28
+ long: { id: 'long-report' },
29
+ },
30
+ })
31
+ ```
32
+
33
+ ## Options
34
+
35
+ | Option | Type | Default | Description |
36
+ | --- | --- | --- | --- |
37
+ | `title` | `string \| (props) => string` | None | Document title. A static string or a function of props. |
38
+ | `filename` | `string \| (props) => string` | None | Download filename, sanitized before use in `content-disposition`. |
39
+ | `language` | `string` | None | Document language tag written to the info dictionary (for example `"en-US"`). |
40
+ | `maxPasses` | `number` | `5` | Maximum layout passes before the multi-pass loop declares non-convergence and throws `PDF_LIMIT_EXCEEDED`. A positive integer. |
41
+ | `sampleData` | `Props` | None | Props used for the default development preview. |
42
+ | `scenarios` | `Record<string, Props>` | None | Named prop sets. Each set becomes a preview tab and a `?scenario=` query. |
43
+
44
+ The `Props` type parameter ties `title`, `filename`, `sampleData`, and each
45
+ `scenario` to the SFC's own props, so a mismatch is a type error.
46
+
47
+ <info icon="lucide:info">
48
+ `maxPasses` is only relevant to documents that read `usePdfPageNumbers()`.
49
+ Every other document renders in a single pass regardless of the value.
50
+ </info>
51
+
52
+ ## Metadata resolution
53
+
54
+ `title` and `filename` functions receive the render props and must return a
55
+ string synchronously. They are resolved at render time. When `title` or
56
+ `language` is present, it is authoritative and overrides the corresponding prop
57
+ authored on `PdfDocument`. When it is absent, the `PdfDocument` value remains the
58
+ rendered fallback. The authoritative values are reapplied after every
59
+ page-number update, so a multi-pass document cannot restore stale root metadata
60
+ between layout passes.
61
+
62
+ `resolveMetadata(props)` on the generated template handle resolves only the
63
+ `definePdf` values without mounting the component. `filename` controls the
64
+ default response filename; it is not a `PdfDocument` prop.
65
+
66
+ ## Preview data is development-only
67
+
68
+ `sampleData` and `scenarios` are used only by the development preview. They are
69
+ never exposed by the public `PdfTemplate` handle.
70
+
71
+ Production compilation keeps only `title`, `filename`, `language`, and
72
+ `maxPasses`. Preview expressions and routes are absent from the Nitro server
73
+ output. Keep preview data representative and disposable. Do not use it as
74
+ production runtime state or a place for secrets.
75
+
76
+ `definePdf()` is module-scoped, like Vue's other hoisted compiler macros. Its
77
+ values may be inline or imported from another module, but they cannot reference
78
+ a variable declared locally in `<script setup>`; that fails compilation instead
79
+ of producing a development-only `ReferenceError`. Keep imported preview-data
80
+ modules free of side effects. Production removes an unused import only when
81
+ evaluating that module has no required behavior.
82
+
83
+ ## Scenarios in the preview
84
+
85
+ ```ts
86
+ definePdf<Props>({
87
+ sampleData: { id: 'sample' },
88
+ scenarios: {
89
+ long: { id: 'long-report' },
90
+ empty: { id: 'no-sections' },
91
+ },
92
+ })
93
+ ```
94
+
95
+ The `long` scenario is available at `/_pdf/report?scenario=long`. An unknown
96
+ scenario name returns a 404 listing the available names.
@@ -0,0 +1,89 @@
1
+ ---
2
+ title: "Errors and limits"
3
+ description: "Error classes, exact codes, render-budget defaults, and when each failure occurs."
4
+ url: "https://nuxt-pdf.lupinum.com/docs/reference/errors-and-limits"
5
+ route: "/docs/reference/errors-and-limits"
6
+ locale: "en"
7
+ section: "Documentation"
8
+ collection: "docs"
9
+ source: "ginko-content"
10
+ ---
11
+
12
+ # Errors and limits
13
+
14
+ > Error classes, exact codes, render-budget defaults, and when each failure occurs.
15
+
16
+ Configuration and asset setup can fail before rendering starts. Public render
17
+ failures use `NuxtPdfError` and one code from `PDF_ERROR_CODES`.
18
+
19
+ ## Error classes and codes
20
+
21
+ | Failure | Stage | Inspect or change |
22
+ | --- | --- | --- |
23
+ | `TypeError` | Module setup | Read the message and correct the module option, template definition, local asset, or configured font. No render or template error code exists yet. |
24
+ | `PDF_TEMPLATE_NOT_FOUND` | Render dispatch | Check the template's relative filename and generated registry key. |
25
+ | `PDF_TEMPLATE_INVALID` | Template execution | Move `definePdf()` or `usePdfPageNumbers()` to its supported template/render scope. |
26
+ | `PDF_TREE_INVALID` | Vue mount or tree validation | Correct the named root, nesting rule, primitive prop, SVG reference, or text placement. |
27
+ | `PDF_LAYOUT_ERROR` | Layout | Check geometry and registered font family, weight, and style. |
28
+ | `PDF_LIMIT_EXCEEDED` | Any bounded render stage | Read the named limit and cap. Reduce the input or change that one configured budget. |
29
+ | `PDF_ASSET_INVALID` | Image admission | Replace invalid admitted PNG or JPEG bytes, dimensions, or declared format. |
30
+ | `PDF_ASSET_BLOCKED` | Image source or request policy | Check the source form, HTTPS allowlist, redirects, and per-hop timeout. |
31
+ | `PDF_RENDER_ERROR` | Render | Inspect the attached message and template identity for an uncategorized engine failure. |
32
+
33
+ `NuxtPdfError` exposes `code`, `templateKey`, and, in development,
34
+ `templateFile`. Its message names the template. Production leaves out the
35
+ relative source path.
36
+
37
+ `PDF_LIMIT_EXCEEDED` covers every configured time and resource budget. An
38
+ oversized local or remote image uses this code. Allowlist and unsupported-source
39
+ policy failures use `PDF_ASSET_BLOCKED`. Invalid bytes that passed the source
40
+ policy use `PDF_ASSET_INVALID`.
41
+
42
+ ## Render limits
43
+
44
+ Every field is an optional positive safe integer. Omitting the `limits` object
45
+ or one field keeps the default below. Invalid configuration throws `TypeError`
46
+ during module setup.
47
+
48
+ | Field | Default | Bounded work |
49
+ | --- | --- | --- |
50
+ | `timeoutMs` | `30_000` | Metadata resolution, mount, assets, every layout pass, serialization, and output collection. |
51
+ | `maxPages` | `2_000` | Laid-out page count. |
52
+ | `maxNodes` | `50_000` | Mounted document-tree nodes. |
53
+ | `maxTreeDepth` | `128` | Mounted document-tree depth. |
54
+ | `maxTextCharacters` | `2_000_000` | Unicode code points in text nodes. |
55
+ | `maxImages` | `256` | Image nodes. |
56
+ | `maxImageBytes` | `10_485_760` | Source bytes for one unique image. |
57
+ | `maxTotalImageBytes` | `33_554_432` | Source bytes across unique images. |
58
+ | `maxImagePixels` | `25_000_000` | Decoded pixels for one unique image. |
59
+ | `maxTotalImagePixels` | `100_000_000` | Decoded pixels across unique images. |
60
+ | `maxRemoteRequests` | `32` | Remote requests, including redirect hops. |
61
+ | `maxRemoteConcurrency` | `4` | Simultaneous remote requests. |
62
+ | `maxOutputBytes` | `67_108_864` | Completed PDF bytes. |
63
+
64
+ Configure overrides in `nuxt.config.ts`:
65
+
66
+ ```ts [nuxt.config.ts]
67
+ export default defineNuxtConfig({
68
+ pdf: {
69
+ limits: {
70
+ maxPages: 500,
71
+ timeoutMs: 20_000,
72
+ },
73
+ },
74
+ })
75
+ ```
76
+
77
+ The timeout is one deadline for the complete public render. It is checked
78
+ between engine stages and cannot interrupt synchronous layout midway. A single
79
+ stage can therefore finish after the deadline before the error is reported.
80
+
81
+ Tree and content limits are checked after Vue mounts and after each destination
82
+ page-number update. Image budgets apply before engine admission. Output is
83
+ collected into one completed buffer and discarded if `maxOutputBytes` is
84
+ exceeded.
85
+
86
+ `maxPasses` is a per-template `definePdf()` option, not a module limit. Its
87
+ default is `5`. A table of contents normally settles after destination numbers
88
+ feed into the next layout pass. Geometry that keeps changing fails with
89
+ `PDF_LIMIT_EXCEEDED`.
@@ -0,0 +1,104 @@
1
+ ---
2
+ title: "Module options"
3
+ description: "Build-time configuration for registered fonts, remote images, and render budgets."
4
+ url: "https://nuxt-pdf.lupinum.com/docs/reference/module-options"
5
+ route: "/docs/reference/module-options"
6
+ locale: "en"
7
+ section: "Documentation"
8
+ collection: "docs"
9
+ source: "ginko-content"
10
+ ---
11
+
12
+ # Module options
13
+
14
+ > Build-time configuration for registered fonts, remote images, and render budgets.
15
+
16
+ Set module options under `pdf` in `nuxt.config.ts`:
17
+
18
+ ```ts [nuxt.config.ts]
19
+ export default defineNuxtConfig({
20
+ modules: ['@lupinum/nuxt-pdf'],
21
+ pdf: {
22
+ fonts: [],
23
+ limits: {},
24
+ remote: undefined,
25
+ },
26
+ })
27
+ ```
28
+
29
+ | Option | Type | Default | Behavior |
30
+ | --- | --- | --- | --- |
31
+ | `fonts` | `PdfFontDeclaration[]` | `[]` | Registers local TTF, OTF, or WOFF2 faces from `pdfs/fonts`. |
32
+ | `remote` | `RemoteAssetOptions` | `undefined` | Enables allowlisted HTTPS image requests. No remote request is admitted when absent. |
33
+ | `limits` | `PdfLimitsOptions` | All documented defaults | Overrides individual fields in the shared render budget. See [Errors and limits](/raw/docs/reference/errors-and-limits.md). |
34
+
35
+ Unknown `pdf` keys fail during module setup.
36
+
37
+ ## pdf.fonts
38
+
39
+ Each entry registers one font face:
40
+
41
+ ```ts [nuxt.config.ts]
42
+ export default defineNuxtConfig({
43
+ pdf: {
44
+ fonts: [
45
+ {
46
+ family: 'Invoice Sans',
47
+ src: 'InvoiceSans-Regular.ttf',
48
+ fontStyle: 'normal',
49
+ fontWeight: 400,
50
+ },
51
+ ],
52
+ },
53
+ })
54
+ ```
55
+
56
+ | Field | Type | Required | Default | Behavior |
57
+ | --- | --- | --- | --- | --- |
58
+ | `family` | `string` | Yes | Required | Family used by the `fontFamily` style property. |
59
+ | `src` | `string` | Yes | Required | TTF, OTF, or WOFF2 path relative to `pdfs/fonts`. |
60
+ | `fontWeight` | `number \| PdfFontWeightName` | No | `400` | Numeric or named weight. |
61
+ | `fontStyle` | `'normal' \| 'italic' \| 'oblique'` | No | `'normal'` | Face style. |
62
+
63
+ Register each weight and style used by a document. Invalid declarations and
64
+ font files throw `TypeError` during module setup. See
65
+ [Add images and fonts](/raw/docs/guides/images-and-fonts.md).
66
+
67
+ ## pdf.remote
68
+
69
+ `remote` admits HTTPS images whose URL starts with an allowed prefix:
70
+
71
+ ```ts [nuxt.config.ts]
72
+ export default defineNuxtConfig({
73
+ pdf: {
74
+ remote: {
75
+ allow: ['https://cdn.example.com/brand/'],
76
+ timeoutMs: 10_000,
77
+ },
78
+ },
79
+ })
80
+ ```
81
+
82
+ | Field | Type | Required | Default | Behavior |
83
+ | --- | --- | --- | --- | --- |
84
+ | `allow` | `string[]` | Yes | Required | Non-empty list of exact `https://host/path/` prefixes. |
85
+ | `timeoutMs` | `number` | No | `10_000` | Timeout for each request or redirect hop. |
86
+
87
+ Allowlist prefixes require a trailing slash. They cannot contain credentials,
88
+ queries, fragments, wildcards, or a non-HTTPS scheme. The
89
+ [remote-image guide](/raw/docs/guides/remote-images.md) defines request and redirect
90
+ behavior.
91
+
92
+ ## Exported types
93
+
94
+ Import these types from `@lupinum/nuxt-pdf`:
95
+
96
+ | Export | Describes |
97
+ | --- | --- |
98
+ | `ModuleOptions` | Complete `pdf` module options. |
99
+ | `PdfFontDeclaration` | One registered font face. |
100
+ | `PdfFontStyle` | Accepted font styles. |
101
+ | `PdfFontWeight` | Numeric or named font weight. |
102
+ | `PdfFontWeightName` | Accepted named font weights. |
103
+ | `RemoteAssetOptions` | Remote image allowlist and timeout. |
104
+ | `PdfLimitsOptions` | Optional render-limit overrides. |
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: "Page sizes"
3
+ description: "Named and custom page dimensions accepted by PdfPage."
4
+ url: "https://nuxt-pdf.lupinum.com/docs/reference/page-sizes"
5
+ route: "/docs/reference/page-sizes"
6
+ locale: "en"
7
+ section: "Documentation"
8
+ collection: "docs"
9
+ source: "ginko-content"
10
+ ---
11
+
12
+ # Page sizes
13
+
14
+ > Named and custom page dimensions accepted by PdfPage.
15
+
16
+ Set `PdfPage.size` to an uppercase named size or to explicit dimensions. The
17
+ default is `A4`.
18
+
19
+ ```vue
20
+ <PdfPage size="LETTER">
21
+ <PdfText>Letter page</PdfText>
22
+ </PdfPage>
23
+ ```
24
+
25
+ Page-size names are case-sensitive:
26
+
27
+ | Family | Accepted names |
28
+ | --- | --- |
29
+ | ISO A | `4A0`, `2A0`, `A0`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10` |
30
+ | ISO B | `B0`, `B1`, `B2`, `B3`, `B4`, `B5`, `B6`, `B7`, `B8`, `B9`, `B10` |
31
+ | ISO C | `C0`, `C1`, `C2`, `C3`, `C4`, `C5`, `C6`, `C7`, `C8`, `C9`, `C10` |
32
+ | Raw format | `RA0`, `RA1`, `RA2`, `RA3`, `RA4` |
33
+ | Supplementary raw format | `SRA0`, `SRA1`, `SRA2`, `SRA3`, `SRA4` |
34
+ | North American and other | `EXECUTIVE`, `FOLIO`, `LEGAL`, `LETTER`, `TABLOID`, `ID1` |
35
+
36
+ ## Custom dimensions
37
+
38
+ Use a two-value tuple or a width/height object. A unitless number is a PDF
39
+ point. String dimensions accept `pt`, `in`, `mm`, `cm`, or `px`:
40
+
41
+ ```vue
42
+ <PdfPage :size="['210mm', '297mm']">
43
+ <PdfText>Custom A4 dimensions</PdfText>
44
+ </PdfPage>
45
+ ```
46
+
47
+ ```vue
48
+ <PdfPage :size="{ width: '4in', height: '6in' }">
49
+ <PdfText>Shipping label</PdfText>
50
+ </PdfPage>
51
+ ```
52
+
53
+ `px` uses the page's `dpi` prop. The default DPI is `72`. Use `orientation` to
54
+ swap portrait and landscape dimensions without reversing the size tuple.
@@ -0,0 +1,216 @@
1
+ ---
2
+ title: "Primitives"
3
+ description: "Prop tables for every document and SVG primitive, drawn from the shipped type definitions."
4
+ url: "https://nuxt-pdf.lupinum.com/docs/reference/primitives"
5
+ route: "/docs/reference/primitives"
6
+ locale: "en"
7
+ section: "Documentation"
8
+ collection: "docs"
9
+ source: "ginko-content"
10
+ ---
11
+
12
+ # Primitives
13
+
14
+ > Prop tables for every document and SVG primitive, drawn from the shipped type definitions.
15
+
16
+ Every primitive is an auto-registered global component. The tables below are
17
+ drawn from the shipped prop types. `style` values use Nuxt PDF's framework-owned
18
+ `PdfStyle` contract, not CSS or the wider upstream stylesheet types (see
19
+ [Styling and layout](/raw/docs/learn/styling-and-layout.md).
20
+
21
+ The same surface is enforced after Vue mounts the tree. Each primitive has a
22
+ closed runtime prop allowlist; unknown props, DOM/event attributes, and props
23
+ used on the wrong primitive fail with `PDF_TREE_INVALID` rather than passing
24
+ through or silently doing nothing.
25
+
26
+ ## Shared base props
27
+
28
+ `PdfPage`, `PdfView`, page-flow `PdfText`, `PdfImage`, `PdfLink`, and `PdfNote`
29
+ share these:
30
+
31
+ | Prop | Type | Default | Description |
32
+ | --- | --- | --- | --- |
33
+ | `id` | `string` | None | Makes the node a named destination for `#id` links and page-number resolution. |
34
+ | `fixed` | `boolean` | `false` | Repeats the node on every page of its flow. |
35
+ | `break` | `boolean` | `false` | Forces a page break before the node. |
36
+ | `minPresenceAhead` | `number` | `0` | Minimum space in points that must follow, or the node moves to the next page. |
37
+ | `debug` | `boolean` | `false` | Draws the node's layout box for debugging. |
38
+ | `style` | `PdfStyleValue` | None | A style object or nested array. `false`, `null`, and `undefined` entries are ignored. |
39
+
40
+ `PdfPage`, `PdfView`, `PdfText`, and `PdfImage` additionally accept `bookmark`
41
+ (`string`, or `{ title, expanded? }`) to build the outline.
42
+
43
+ ## PdfDocument
44
+
45
+ The root. Carries document metadata; takes no base props.
46
+
47
+ | Prop | Type | Default | Description |
48
+ | --- | --- | --- | --- |
49
+ | `title`, `author`, `subject`, `keywords` | `string` | None | Info-dictionary metadata. |
50
+ | `creator`, `producer` | `string` | `'nuxt-pdf'` | Info-dictionary producer metadata. |
51
+ | `language` | `string` | None | Document language tag. |
52
+ | `creationDate` | `Date` | Current render date | Info-dictionary creation date. |
53
+ | `pdfVersion` | `'1.3'` through `'1.7'` or `'1.7ext3'` | `'1.3'` | PDF version written to the catalog. |
54
+ | `pageLayout` | `'singlePage' \| 'oneColumn' \| 'twoColumnLeft' \| 'twoColumnRight' \| 'twoPageLeft' \| 'twoPageRight'` | None | Reader page layout. |
55
+
56
+ Reader page mode, encryption passwords, and PDF permission flags are not public
57
+ props. Their serialized behavior is not part of the current public contract.
58
+
59
+ `modificationDate` is also absent. The pinned engine writes its
60
+ upstream prop under a non-standard custom key rather than the PDF `ModDate`
61
+ entry, so exposing it would promise metadata that common readers do not see.
62
+
63
+ When `definePdf` supplies `title` or `language`, that value is authoritative and
64
+ overrides the corresponding `PdfDocument` prop. Without a definition value, the
65
+ root prop is preserved as the rendered fallback. Nuxt PDF reapplies the
66
+ authoritative values after each page-number update in a multi-pass render.
67
+
68
+ ## PdfPage
69
+
70
+ | Prop | Type | Default | Description |
71
+ | --- | --- | --- | --- |
72
+ | `size` | `PdfPageSizeName \| [w, h] \| { width, height }` | `'A4'` | Uppercase named size or explicit dimensions. See [Page sizes](/raw/docs/reference/page-sizes.md). |
73
+ | `orientation` | `'portrait' \| 'landscape'` | `'portrait'` | Page orientation. |
74
+ | `dpi` | `number` | `72` | DPI used for `px` dimensions. |
75
+ | `wrap` | `boolean` | `true` | Paginates content. `false` grows the page to fit. |
76
+
77
+ Plus the base and bookmark props.
78
+
79
+ ## PdfView
80
+
81
+ The flexbox container. Base and bookmark props, plus:
82
+
83
+ | Prop | Type | Default | Description |
84
+ | --- | --- | --- | --- |
85
+ | `wrap` | `boolean` | `true` | Allows the view to split across a page boundary. |
86
+
87
+ ## PdfText
88
+
89
+ The only container for text has two context-specific prop branches.
90
+
91
+ In normal page flow it accepts the base and bookmark props, plus:
92
+
93
+ | Prop | Type | Default | Description |
94
+ | --- | --- | --- | --- |
95
+ | `wrap` | `boolean` | `true` | Allows text to split across pages. |
96
+ | `widows` | `number` | `2` | Minimum lines kept together at a page top. |
97
+ | `orphans` | `number` | `2` | Minimum lines kept together at a page bottom. |
98
+ | `render` | `({ pageNumber, totalPages, subPageNumber, subPageTotalPages }) => string \| number \| null \| undefined` | None | Synchronous dynamic text. |
99
+ | `hyphenationCallback` | `(word: string) => string[]` | Engine default | Returns custom hyphenation break points. |
100
+
101
+ Inside `PdfSvg`, it instead accepts:
102
+
103
+ | Prop | Type | Default | Description |
104
+ | --- | --- | --- | --- |
105
+ | `x`, `y` | `PdfSvgLength` | Required | SVG text coordinates. |
106
+ | `fill` | `string` | None | Direct SVG text paint color. |
107
+ | `style` | `PdfStyleValue` | None | Text metrics such as font family and size. `color` is not SVG paint. |
108
+ | `hyphenationCallback` | `(word: string) => string[]` | Engine default | Returns custom hyphenation break points. |
109
+
110
+ SVG text rejects page-flow-only props such as `id`, `bookmark`, `fixed`,
111
+ `break`, `wrap`, `widows`, `orphans`, and `render`.
112
+
113
+ ## PdfImage
114
+
115
+ Base and bookmark props, plus:
116
+
117
+ | Prop | Type | Default | Description |
118
+ | --- | --- | --- | --- |
119
+ | `src` | `PdfImageSource` | Required | Image source. |
120
+
121
+ `PdfImageSource` is a `pdfs/assets`-relative path, a `Uint8Array`/`ArrayBuffer`,
122
+ `{ data, format: 'png' \| 'jpg' }`, or `{ uri, format? }`.
123
+
124
+ ## PdfLink
125
+
126
+ Base props (no bookmark), plus:
127
+
128
+ | Prop | Type | Default | Description |
129
+ | --- | --- | --- | --- |
130
+ | `href` | `string` | Required | External `https:` or `mailto:` URL, or a `#id` internal destination. |
131
+ | `wrap` | `boolean` | `true` | Allows the link to split across pages. |
132
+ | `hitSlop` | `{ top?, right?, bottom?, left? }` | None | Expands the clickable area. |
133
+
134
+ ## PdfNote
135
+
136
+ A sticky-note annotation. Base props only; its text comes from its content.
137
+
138
+ ---
139
+
140
+ ## SVG primitives
141
+
142
+ SVG primitives render inside a `PdfSvg`. Paint, geometry, clipping, and
143
+ transforms are direct props. `PdfG` and the shape primitives have no generic
144
+ `style` prop, so there is no style-precedence path; kebab-case Vue attributes
145
+ are normalized to the equivalent camelCase key. See
146
+ [SVG graphics](/raw/docs/guides/svg-graphics.md).
147
+
148
+ `PdfSvgNumber` is a finite number or numeric string. `PdfSvgLength` additionally
149
+ accepts a numeric percentage string where the individual prop permits it.
150
+ `strokeWidth` is never a percentage. Non-negative geometry and unit-interval
151
+ opacity/stop ranges are checked at runtime.
152
+
153
+ ### Shared SVG presentation props
154
+
155
+ Available on `PdfG`, `PdfPath`, `PdfRect`, `PdfCircle`, `PdfEllipse`, `PdfLine`,
156
+ `PdfPolyline`, and `PdfPolygon`:
157
+
158
+ | Prop | Type |
159
+ | --- | --- |
160
+ | `fill`, `stroke` | `string` |
161
+ | `fillOpacity`, `strokeOpacity` | `PdfSvgLength` (0 to 1 or 0% to 100%) |
162
+ | `strokeWidth` | `PdfSvgNumber` (non-negative) |
163
+ | `strokeLinecap` | `'butt' \| 'round' \| 'square'` |
164
+ | `strokeLinejoin` | `'miter' \| 'round' \| 'bevel'` |
165
+ | `transform` | `PdfSvgTransform`. One to three unitless `translate(...)` or `rotate(...)` operations. |
166
+ | `clipPath` | `string` with the value `url(#id)` |
167
+
168
+ ### Geometry props
169
+
170
+ | Component | Own props |
171
+ | --- | --- |
172
+ | `PdfSvg` | `viewBox`, `width`, `height`, plus page-flow `style` (not SVG presentation) |
173
+ | `PdfG` | _(presentation props only)_ |
174
+ | `PdfPath` | `d` **(required)** |
175
+ | `PdfRect` | `x`, `y`, `width` **(required)**, `height` **(required)**, `rx`, `ry` |
176
+ | `PdfCircle` | `cx`, `cy`, `r` **(required)** |
177
+ | `PdfEllipse` | `cx`, `cy`, `rx` **(required)**, `ry` **(required)** |
178
+ | `PdfLine` | `x1`, `y1`, `x2`, `y2` **(all required)** |
179
+ | `PdfPolyline` / `PdfPolygon` | `points` **(required)** |
180
+ | `PdfDefs` | None. It holds definitions that other elements can reference. |
181
+ | `PdfClipPath` | `id` **(required)** |
182
+ | `PdfLinearGradient` | `id` **(required)**, `x1`, `y1`, `x2`, `y2` |
183
+ | `PdfRadialGradient` | `id` **(required)**, `cx`, `cy`, `r`, `fx`, `fy` |
184
+ | `PdfStop` | `offset` **(required)**, `stopColor` **(required)**, `stopOpacity` |
185
+ | `PdfTspan` | `x`, `y`, `fill` only |
186
+
187
+ Alternate gradient coordinate systems, transforms, inheritance, and SVG
188
+ `preserveAspectRatio` modes are not public props. See
189
+ [Supported behavior and limitations](/raw/docs/examples/supported-behavior.md).
190
+
191
+ Each `PdfSvg` accepts at most one direct `PdfDefs` child. Definition ids are
192
+ safe, unique, and scoped to that one SVG. `fill="url(#id)"` must resolve to a
193
+ linear or radial gradient; `clipPath="url(#id)"` must resolve to a
194
+ `PdfClipPath`. Missing, malformed, or incompatible references fail with
195
+ `PDF_TREE_INVALID`.
196
+
197
+ Explicit zero has SVG semantics: zero fill opacity is transparent, zero stroke
198
+ width removes the stroke instead of requesting a PDF hairline, and supported
199
+ gradient coordinates remain zero. The engine repairs upstream truthiness
200
+ fallbacks after layout and before serialization.
201
+
202
+ ## Exported primitive types
203
+
204
+ Import prop and value types from `@lupinum/nuxt-pdf` when you type reusable
205
+ document components:
206
+
207
+ | Area | Exports |
208
+ | --- | --- |
209
+ | Shared | `PdfBaseProps`, `PdfBookmark` |
210
+ | Document flow | `PdfDocumentProps`, `PdfPageProps`, `PdfViewProps`, `PdfTextProps`, `PdfImageProps`, `PdfLinkProps`, `PdfNoteProps` |
211
+ | Images | `PdfImageSource` |
212
+ | Page dimensions | `PdfPageDimension`, `PdfPageSize`, `PdfPageSizeName`, `PdfPageUnit` |
213
+ | SVG containers | `PdfSvgProps`, `PdfGProps`, `PdfDefsProps`, `PdfClipPathProps` |
214
+ | SVG shapes | `PdfPathProps`, `PdfRectProps`, `PdfCircleProps`, `PdfEllipseProps`, `PdfLineProps`, `PdfPolylineProps`, `PdfPolygonProps` |
215
+ | SVG gradients and text | `PdfLinearGradientProps`, `PdfRadialGradientProps`, `PdfStopProps`, `PdfTspanProps` |
216
+ | SVG values | `PdfSvgNumber`, `PdfSvgLength`, `PdfSvgPresentationProps`, `PdfSvgTransform`, `PdfSvgTransformOperation` |