kempsteven / vue-html2pdf

vue-html2pdf converts any vue component or element into PDF, vue-html2pdf is basically a vue wrapper only and uses html2pdf.js behind the scenes.
https://www.npmjs.com/package/vue-html2pdf
MIT License
432 stars 75 forks source link

How to improve background image quality? #109

Open ElPablo010 opened 2 years ago

ElPablo010 commented 2 years ago

Hi Steven

In my vue app, I'm using vue html 2 pdf to create downloadable pdf's. My problem is that the generated pdf background image is kinda blurry.

Despite digging into the package documentation and other related posts, I can't manage to get it fixed. Can you think of a solution?

My Vue Js component code:

`<vue-html2pdf :show-layout="false" :float-layout="true" :enable-download="true" :preview-modal="true" :paginate-elements-by-height="1400" filename="flavourmap" :pdf-quality="2" :manual-pagination="true" pdf-format="A4" :pdf-orientation="orientation" pdf-content-width="100%" :image="{ type: 'jpg', quality: 1 }" @progress="onProgress($event)" @startPagination="hasStartedGeneration()" @hasDownloaded="hasDownloaded($event)" ref="html2Pdf"

`

zerogravity2020 commented 2 years ago

html-to-pdf-options: { html2canvas: { useCORS: true, scale: 4, // resolution }, }

Sanan4li commented 2 months ago

Thank you very much @zerogravity2020 it improved the PDF file quality as well.