Skip to main content

Module options

Build-time configuration for registered fonts, remote images, and render budgets.

Set module options under pdf in nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@lupinum/nuxt-pdf'],
  pdf: {
    fonts: [],
    limits: {},
    remote: undefined,
  },
})
OptionTypeDefaultBehavior
fontsPdfFontDeclaration[][]Registers local TTF, OTF, or WOFF2 faces from pdfs/fonts.
remoteRemoteAssetOptionsundefinedEnables allowlisted HTTPS image requests. No remote request is admitted when absent.
limitsPdfLimitsOptionsAll documented defaultsOverrides 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:

nuxt.config.ts
export default defineNuxtConfig({
  pdf: {
    fonts: [
      {
        family: 'Invoice Sans',
        src: 'InvoiceSans-Regular.ttf',
        fontStyle: 'normal',
        fontWeight: 400,
      },
    ],
  },
})
FieldTypeRequiredDefaultBehavior
familystringYesRequiredFamily used by the fontFamily style property.
srcstringYesRequiredTTF, OTF, or WOFF2 path relative to pdfs/fonts.
fontWeightnumber | PdfFontWeightNameNo400Numeric 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:

nuxt.config.ts
export default defineNuxtConfig({
  pdf: {
    remote: {
      allow: ['https://cdn.example.com/brand/'],
      timeoutMs: 10_000,
    },
  },
})
FieldTypeRequiredDefaultBehavior
allowstring[]YesRequiredNon-empty list of exact https://host/path/ prefixes.
timeoutMsnumberNo10_000Timeout 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:

ExportDescribes
ModuleOptionsComplete pdf module options.
PdfFontDeclarationOne registered font face.
PdfFontStyleAccepted font styles.
PdfFontWeightNumeric or named font weight.
PdfFontWeightNameAccepted named font weights.
RemoteAssetOptionsRemote image allowlist and timeout.
PdfLimitsOptionsOptional render-limit overrides.