I need some help, why is it that the resolution of my html2pdf
is blurry? How can I adjust the resolution?.
There are some parameters like ImageQuality
and DisablePdfCompression
you have to pass which is defining the image quality, pdf compression and pdf size. Here is some details of it.
ImageQuality
Integer: Values from 1 to 100 resp. 101. Default is 101 (lossless compression) Can be used to decrease PDF files size. The smaller the value the smaller the PDF file size. A reasonable value is 75.
DisablePdfCompression
Integer: 0 (Standard), 1 do not use lossless compression on pdf objects
For more details : http://www.html2pdf.solutions/en/Support/Parameters_for_html2pdf.htm
It's work for me!
var opt = {
margin: [15, 0, 15, 0],
filename: `CV-${name}.pdf`,
image: { type: 'jpeg', quality: 1 },
html2canvas: {
dpi: 192,
scale:4,
letterRendering: true,
useCORS: true
},
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
};
This is an example in js if someone use this lib
https://github.com/eKoopmans/html2pdf#image-type-and-quality
You can pass an option html2pdf(content, option)
Try this, html2pdf(document.body, {html2canvas: { scale: 4 }})
I guess in php, it should be similar.
There are some parameters like ImageQuality
and DisablePdfCompression
you have to pass which is defining the image quality, pdf compression and pdf size. Here is some details of it.
ImageQuality
Integer: Values from 1 to 100 resp. 101. Default is 101 (lossless compression) Can be used to decrease PDF files size. The smaller the value the smaller the PDF file size. A reasonable value is 75.
DisablePdfCompression
Integer: 0 (Standard), 1 do not use lossless compression on pdf objects
For more details : http://www.html2pdf.solutions/en/Support/Parameters_for_html2pdf.htm
© 2022 - 2024 — McMap. All rights reserved.