Get Started
Quick Start
Quick Start
<script setup lang="ts">
import { ref } from 'vue'
import { Html2Pdf } from 'vue-pdf-export'
import 'vue-pdf-export/style.css'
const pdfRef = ref<InstanceType<typeof Html2Pdf> | null>(null)
async function generatePdf() {
const blob = await pdfRef.value?.generatePdf()
console.log(blob)
}
</script>
<template>
<button type="button" @click="generatePdf">Generate PDF</button>
<Html2Pdf
ref="pdfRef"
filename="my-report"
render-mode="canvas"
:manual-pagination="true"
:enable-download="true"
>
<template #pdf-content>
<div>
<h1>My Report</h1>
<p>This content will be rendered into the PDF.</p>
</div>
</template>
</Html2Pdf>
</template>
