[Html2PdfConverter] File size of the pdf

Forge Component
(70)
Published on 2 Jun (3 days ago) by Guilherme Pereira
70 votes
Published on 2 Jun (3 days ago) by Guilherme Pereira

Hi,


is there a way on how to reduce the file size of the pdf being generated by the html2pdf converter?


thanks in advance

Solution

Hi Mark,


Im quoting this thread on stackoverflow with the exact same question.


The flag that works best for me in reducing file size is 

--image-dpi 300

As the default DPI is 600, this can reduce the filesize of an image-heavy PDF by 75% and is still good enough for most purposes.

There are two other flags you can use:

--lowquality - supposedly makes it smaller

--image-quality 80 - jpeg compression, default is 94

but overall I find the DPI makes the biggest difference, and if you aren't printing to 600dpi or zooming then you're not really losing anything.

For your use case also try

--no-outline - as you likely don't need a contents section

and the self-explanatory

--disable-internal-links

--disable-external-links

but these are likely to be smaller wins.


Hope this helps


Guilherme

Solution

Guilherme Pereira wrote:

Hi Mark,


Im quoting this thread on stackoverflow with the exact same question.


The flag that works best for me in reducing file size is 

--image-dpi 300

As the default DPI is 600, this can reduce the filesize of an image-heavy PDF by 75% and is still good enough for most purposes.

There are two other flags you can use:

--lowquality - supposedly makes it smaller

--image-quality 80 - jpeg compression, default is 94

but overall I find the DPI makes the biggest difference, and if you aren't printing to 600dpi or zooming then you're not really losing anything.

For your use case also try

--no-outline - as you likely don't need a contents section

and the self-explanatory

--disable-internal-links

--disable-external-links

but these are likely to be smaller wins.


Hope this helps


Guilherme

Thanks Guilherme it works 


Hi, I just upgraded from OS 10 to 11 and the files that I got before conversion were like 80 to 90KB and now the same process is generating the same file as 4.4MB, I went to args in the generatePDF action but the dpi is not working, what can I do??  please help!