Quick Start
After installing the package, add the package to your nuxt.config.ts
:
export default defineNuxtConfig({ modules: ['@sidebase/nuxt-pdf'],})
That's it! You can now begin exporting Nuxt 3 components to PDF. For example:
<template> <div> <div ref="pdfSection"> Thanks for testing out nuxt-pdf! </div> <button @click="exportToPDF('my-pdf-file.pdf', pdfSection)"> print card </button> </div></template><script setup lang="ts">import { ref } from 'vue'import { exportToPDF } from '#imports'const pdfSection = ref<HTMLElement | null>(null)</script>
We offer two separate options parameters, that allow you to customize your pdf export.