API
TypeScript
Use the TypeScript declarations and public types shipped by vue-pdf-export for PDF outputs, component options, events, headers, footers and watermark configuration.
The package ships TypeScript declarations.
The current declarations include PdfCompositionOptions, PdfTemplateSource, PdfPaginationDiagnostic, and PdfPaginationDiagnosticType. See the v1 API reference when maintaining an older installation.
Common types:
import type {
BeforeDownloadPayload,
FooterMode,
FooterOptions,
PdfCompositionOptions,
PdfTemplateSource,
PdfPaginationDiagnostic,
PdfPaginationDiagnosticType,
GeneratePdfResult,
HeaderOptions,
Html2CanvasOptions,
Html2PdfOptions,
Html2PdfProps,
JsPdfOptions,
PdfAutoFitOptions,
PdfBase64Options,
PdfEncryptionOptions,
PdfFormat,
PdfGenerationCompletePayload,
PdfGenerationMetrics,
PdfImageOptions,
PdfMargin,
PdfMetadataOptions,
PdfOrientation,
PdfOutputFormat,
PdfPageBreakOptions,
PdfPageContext,
PdfPageTarget,
PdfPermission,
PdfProgressStage,
PdfProgressState,
PdfRenderMode,
PdfSecurityOptions,
PdfSerializedOutput,
PdfStyle,
PdfStylingOptions,
WatermarkLayer,
WatermarkMode,
WatermarkOptions,
WatermarkType,
} from 'vue-pdf-export'
Render mode type:
export type PdfRenderMode = 'canvas' | 'text'
Output types:
export type PdfOutputFormat = 'blob' | 'arraybuffer' | 'base64'
export interface PdfBase64Options {
dataUrl?: boolean
}
export type PdfSerializedOutput = Blob | ArrayBuffer | string
Useful helpers:
import {
createPdfOptions,
normalizePdfFilename,
pdfBlobToArrayBuffer,
pdfBlobToBase64,
resolvePdfPages,
serializePdfOutput,
} from 'vue-pdf-export'
Filename Normalization
import { normalizePdfFilename } from 'vue-pdf-export'
normalizePdfFilename('invoice:/customer?2026')
// invoice--customer-2026.pdf
Normalization:
- adds exactly one
.pdfextension - prevents duplicate
.pdf - sanitizes unsafe filename/path characters
- trims trailing dots and spaces
- falls back to a timestamp for empty names
- protects Windows reserved device names such as
CONandLPT1 - preserves Unicode
- limits excessively long base names
Examples:
normalizePdfFilename('report')
// report.pdf
normalizePdfFilename('report.PDF')
// report.pdf
normalizePdfFilename('CON')
// _CON.pdf
Loader, Progress, Metrics, Events & Slots
Build custom vue-pdf-export UI with loaders, progress state, generation metrics, component events and slots for PDF content and user-defined loading experiences.
PDF Styling & data-pdf-ignore
Customize export-only page and body styles, CSS classes, themes and auto-fit behavior, and exclude screen-only elements using data-pdf-ignore.
