Getting Started

Installation

Install the core @vuepdf/renderer package using your preferred package manager:

pnpm
pnpm add @vuepdf/renderer
npm
npm i @vuepdf/renderer
yarn
yarn add @vuepdf/renderer
bun
bun add @vuepdf/renderer

Nuxt Setup

For Nuxt projects, add @vuepdf/nuxt to the modules array in your nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@vuepdf/nuxt'],
})

That's it. The module auto-registers all 30+ components (<Document>, <Page>, <Text>, <View>, <Image>, SVG primitives, form components, and more) plus the usePDF, pdf(), Font, and StyleSheet utilities — no explicit imports needed.

It also configures the parts you would otherwise have to wire by hand:

  • Transpiles the vue-pdf packages for Vite.
  • Registers a Vue SFC plugin with Nitro, so a server route can import your document .vue file and render a PDF on the server.
  • Resolves every component through a single copy of the renderer. Loading two copies gives you two injection contexts, which silently produces a blank PDF.
Server-side PDF rendering in Nuxt needs this module. If you configure components and build.transpile manually instead, client-side rendering works but server/ routes that import a .vue document will fail to build.
Both the @vuepdf/nuxt module and the @vuepdf/renderer package have Vue 3 and Nuxt 3 as peer dependencies. Make sure your project has them installed.

Vue (Without Nuxt)

Import components directly from the renderer package:

App.vue
<script setup lang="ts">
import { Document, Page, Text, View } from '@vuepdf/renderer'
</script>

<template>
  <Document>
    <Page size="A4">
      <View style="padding: 40px">
        <Text style="font-size: 18px">Hello, PDF!</Text>
      </View>
    </Page>
  </Document>
</template>

Optional Extension Packages

vue-pdf ships with optional extension packages for specialized content:

@vuepdf/math

Render LaTeX math expressions as inline SVG.

bash
pnpm add @vuepdf/math
@vuepdf/mermaid

Render Mermaid diagrams embedded in your PDF.

bash
pnpm add @vuepdf/mermaid

Peer Dependencies

@vuepdf/renderer requires Vue as a peer dependency:

bash
vue    >= 3.5.0

Next Steps