vue-pdfmake
vue-pdfmake copied to clipboard
blank output
trafficstars
I just tried this package and followed the README/demo, but getting blank page in the output.
I am not sure if I am supposed to pass any options inside pdf.createPdf() method.
Sharing the stackblitz link https://stackblitz.com/edit/vitejs-vite-q2br2u
The generation example was improved, and now in the 2.2.0 version it is possible to install the fonts provided by pdfmake by default, making it easier to understand how to use it.
It will probably solve your problem:
<script setup>
import { usePDF } from 'vue3-pdfmake';
const pdfmake = usePDF({
autoInstallVFS: true
})
const onGenPDF = () => {
pdfmake.createPdf({
content: [
'Hello World From PDFMake!',
]
}).download();
}
</script>
<template>
<button @click="onGenPDF">Click here for download demo pdf</button>
</template>
For more information, see the PDFMake 0.3x documentation.