简体   繁体   中英

How to reduce the PDF file size of MPDF

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]

https://pastebin.com/fvvADjxh

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.

Try whether pdftk compression significantly reduces the size of your PDF file.

pdftk file1.pdf output file2.pdf compress

If you are satisfied with the results, I can enhance our object-oriented PHP pdftk wrapper with the capability to compress PDF files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM