tpisto / pdf-fill-form

Fill PDF forms and return either filled PDF or PDF created from rendered page images.
MIT License
227 stars 48 forks source link

File size increses 10 times when using imgpdf #88

Closed alayor closed 4 years ago

alayor commented 4 years ago

The output file increases from 500KB to 10MB when I use the 'imgpdf'. This doesn't happen with the 'pdf' option. Is there any way to fix this?

jybleau commented 4 years ago

I'm starting to work with the library.

I guess it depends first on the complexity of your original PDF...

Did you try to change the scale (default to 0.2) factor and antialiasing (defaut false) properties? What optimisation could you get from it?

Scale factor defaul means 360dpi image per pages (72pdi / 0.2). It probably explains your situation. A scale of 0.72 would give you 100dpi.

ref:

https://github.com/tpisto/pdf-fill-form/blob/master/src/NodePoppler.cc#L106 https://people.freedesktop.org/~aacid/docs/qt5/classPoppler_1_1Page.html#ae37d9b14a50231ed92260552964a1ed2

if I understood the code correctly...