I have a project in vuejs and I have to use vue-html2pdf.
When I write text the in tag: <section>something</section>
, my PDF is generated.
But when I write in tag: <section><p>something</p></section>
, my browser is crashes.
Here my code in vuejs:
<vue-html2pdf
:show-layout="false"
:preview-modal="true"
:paginate-elements-by-height="10"
:filename="test"
:pdf-quality="2"
:pdf-format="size"
:ref="ref"
>
<section slot="pdf-content">
<section class="pdf-item">
<img :src=url>
</section>
</section>
</vue-html2pdf>
And my function to download PDF:
function generateReport() {
this.$refs.html2Pdf.generatePdf();
}
vue-html2pdf
npm module does not work properly. Rather than you can try html2pdf
module for convert html to pdf in vuejs
.
Package link: https://www.npmjs.com/package/html2pdf.js/v/0.9.1
Codesandbox Example: https://codesandbox.io/s/xlnzq7y28q
Hope that, your problem will be solved. Thanks.