[Html2PdfConverter] File size of the pdf

Forge Component
(60)
Published on 17 May by Guilherme Pereira
60 votes
Published on 17 May 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