I am creating a 15 to 20 pages PDF using MPDF on Form Submission. PDF file size comes around 2.5MB. Is there a way to reduce the file size below 1 MB?
Since the SetCompression() default value is True, I tried setting this to False and checked the file size of PDF. There is no change in file size. I tried SetCompression() and still no luck. I even reduced the PDF to 3 pages, size sill comes around 1.5MB. Is there any other way to reduce the file size?
Can someone help me with this?
Below is the link for the code which I used.
[https://pastebin.com/fvvADjxh][1]
Advertisement
Answer
Compress your images.
Image raven_tours_treks_logo.jpg
in your code is 619,75 kB. The file contains it twice – by compressing it correctly, you can save a megabyte or so.
raven_tours_treks.jpg
has almost a megabyte. It can safely be reduced to 80kB or so – another megabyte saved.