Module options
Build-time configuration for registered fonts, remote images, and render budgets.
Set module options under pdf in nuxt.config.ts:
export default defineNuxtConfig({
modules: ['@lupinum/nuxt-pdf'],
pdf: {
fonts: [],
limits: {},
remote: undefined,
},
})| Option | Type | Default | Behavior |
|---|---|---|---|
fonts | PdfFontDeclaration[] | [] | Registers local TTF, OTF, or WOFF2 faces from pdfs/fonts. |
remote | RemoteAssetOptions | undefined | Enables allowlisted HTTPS image requests. No remote request is admitted when absent. |
limits | PdfLimitsOptions | All documented defaults | Overrides individual fields in the shared render budget. See Errors and limits. |
Unknown pdf keys fail during module setup.
pdf.fonts
Each entry registers one font face:
export default defineNuxtConfig({
pdf: {
fonts: [
{
family: 'Invoice Sans',
src: 'InvoiceSans-Regular.ttf',
fontStyle: 'normal',
fontWeight: 400,
},
],
},
})| Field | Type | Required | Default | Behavior |
|---|---|---|---|---|
family | string | Yes | Required | Family used by the fontFamily style property. |
src | string | Yes | Required | TTF, OTF, or WOFF2 path relative to pdfs/fonts. |
fontWeight | number | PdfFontWeightName | No | 400 | Numeric or named weight. |
fontStyle | 'normal' | 'italic' | 'oblique' | No | 'normal' | Face style. |
Register each weight and style used by a document. Invalid declarations and
font files throw TypeError during module setup. See
Add images and fonts.
pdf.remote
remote admits HTTPS images whose URL starts with an allowed prefix:
export default defineNuxtConfig({
pdf: {
remote: {
allow: ['https://cdn.example.com/brand/'],
timeoutMs: 10_000,
},
},
})| Field | Type | Required | Default | Behavior |
|---|---|---|---|---|
allow | string[] | Yes | Required | Non-empty list of exact https://host/path/ prefixes. |
timeoutMs | number | No | 10_000 | Timeout for each request or redirect hop. |
Allowlist prefixes require a trailing slash. They cannot contain credentials, queries, fragments, wildcards, or a non-HTTPS scheme. The remote-image guide defines request and redirect behavior.
Exported types
Import these types from @lupinum/nuxt-pdf:
| Export | Describes |
|---|---|
ModuleOptions | Complete pdf module options. |
PdfFontDeclaration | One registered font face. |
PdfFontStyle | Accepted font styles. |
PdfFontWeight | Numeric or named font weight. |
PdfFontWeightName | Accepted named font weights. |
RemoteAssetOptions | Remote image allowlist and timeout. |
PdfLimitsOptions | Optional render-limit overrides. |