Vue3HtmlToPdf blank PDF if there is a large number of pages

  Kiến thức lập trình

I use vue3htmltopdf to generate pdf, it works well, but when about 15 pages(when big ResultView) worth of data is added to it, the pdf turns out to be empty. i’ve looked for some solutions, but the same problems have no answers.


const htmlToPdfOptions = {
  html2canvas: {
    useCORS: true,
    dpi: 192,
    scale: 4,
    letterRendering: true
  },
  margin: [5, 0, 0, 0],
  filename: `${format(new Date(), 'dd.MM.yyyy')}.pdf`,
  pagebreak: {
    mode: ['css']
  }
}


<template>
  <Vue3Html2pdf
      :class="{'is-hidden': !isGenerated}"
      :show-layout="false"
      :float-layout="true"
      :enable-download="isDownloadPdf"
      :preview-modal="isPrintPdf"
      :paginate-elements-by-height="1400"
      :filename="`${format(new Date(), 'dd.MM.yyyy')}`"
      :pdf-quality="2"
      :manual-pagination="false"
      :image="{type: 'jpeg', quality: 1}"
      pdf-format="a4"
      pdf-orientation="portrait"
      pdf-content-width="100%"
      :html-to-pdf-options="htmlToPdfOptions"
      @startPagination="generating()"
      @hasDownloaded="generated()"
      ref="html2Pdf">
    <template v-slot:pdf-content>
<ResultView :is-print="true"></ResultView>

    </template>
  </Vue3Html2pdf>
</template>

tried changing dpi from 192 to 96 and resolution, but it didn’t help

LEAVE A COMMENT