vue-pdfmake icon indicating copy to clipboard operation
vue-pdfmake copied to clipboard

blank output

Open sh00nyan opened this issue 2 years ago • 1 comments
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

sh00nyan avatar May 07 '23 04:05 sh00nyan

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.

Novout avatar May 07 '23 15:05 Novout