Jump to content
thirty bees forum
  • 0

How to reduce generated PDF file size


Question

Posted

Today I came across new problem, my Carrier added an option where I have to upload the Invoice (proforma invoice) when creating shipping order.

However, the generated PDF from thirty bees is too big as they have maximum size limit.

Is there an option to make some override for the PDF output quality?

 

Thank you.

Dejan

2 answers to this question

Recommended Posts

  • 0
Posted

One of the reasons the pdf can be so huge is the used font. You can tweak used fonts in file classes/pdf/PDFGenerator.php, property $font_by_lang.

For example, deleting line 

'en' => 'dejavusans'

Can reduce pdf size from 461K to 15k.

Of course, the resulting pdf might look different. Or completely broken, if your language contains weird characters such as 'příliš žluťoučký kůň'

  • Like 1
  • Thanks 1
  • 0
Posted (edited)

Thank you for your quick answer.

As I already have override on that file due to encoding error for Slovenian language ( 'sl' => 'dejavusans',)

so I just made additional change for english language to helvetica ('en' => 'helvetica',)

and that reduced the english generated PDF from 501k to 45k.

Thank you quick solution, that was all I needed.

 

30 minutes ago, datakick said:

'příliš žluťoučký kůň

Didn't spot one yet 🙂

 

Edited by toplakd

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...