html2pdf.js icon indicating copy to clipboard operation
html2pdf.js copied to clipboard

How to compress PNG images using canvas-png-compression shim?

Open simixmc opened this issue 2 years ago • 0 comments

How to compress PNG images using canvas-png-compression shim?

The description says that it is possible, but how to do it is not clear.

const element = getIframeContent('data-frame'); const opt = { margin: 0, filename: '<?=$this->input->get('id');?>.pdf', pagebreak: { mode: 'css', after: '.break-point' }, image: { type: 'png'}, enableLinks: false, html2canvas: { dpi: 192, scale: 1, scrollX: 0, scrollY: 0, backgroundColor: '#ffc52f', letterRendering: true, }, jsPDF: { unit: 'mm', format: 'a4', putOnlyUsedFonts: true, orientation: 'portrait', compress: true, precision: 8, marginLeft: 0, marginTop: 0, marginBottom: 0, marginRight:0, backgroundColor: '#ffc52f', floatPrecision:'smart' }, noPdfOpenParams: true }; html2pdf().set(opt).from(element).save();

simixmc avatar May 26 '23 13:05 simixmc