Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.
This is the legacy Gravity PDF v3 documentation which is NOT supported. Go to the latest documentation.

Memory Problems

Gravity PDF is very memory intensive and it isn’t uncommon to have memory issues on shared hosting services. The best way to solve memory issues is to increase memory to the recommended 128MB but this isn’t always possible.

Things you can do…

Note: All the following constants are located at the bottom of the configuration.php file which is located in the PDF_EXTENDED_TEMPLATES folder.
  1. If your template uses large tables, you can set PDF_ENABLE_SIMPLE_TABLES to true.
  2. Another option is to set PDF_DISABLE_FONT_SUBSTITUTION to true which will embed the full font file directly into the PDF. This has the negative impact of increasing the PDF’s total size, but will keep memory down. PDFs displaying only English characters can negate this effect by setting the font to one of the defaults – Arial, Times, or Courier.
  3. Setting PDF_ENABLE_MPDF_LITE to true will strip out some of the more advanced features from the package such as complex table borders, terms and conditions, columns, index, bookmarks and barcodes.
  4. As a last resort you can try set PDF_ENABLE_MPDF_TINY to true which will only load the bare minimum features. Along with the features disabled by enabling PDF_ENABLE_MPDF_LITE, there’s no positioning, float, watermark or form support.

You should also keep in mind the following when creating your template files.

  1. If using images the best format is JPG, followed by PNG files that aren’t interlaced and have no alpha channel. Keep away from GIF files and interlaced or alpha channel PNGs as they require a lot more memory to process.
  2. Limit the number of fonts used – try stick to one. If you can, you should use the base PDF fonts – Arial, Times, or Courier – which don’t need to be embedded into the PDF.
    Note: the base fonts have limited support for non-Western European languages.
  3. Instead of using HTML attributes to format the PDF you should use CSS styles.
  4. Don’t use the CSS property “overflow” as it will slow down the PDF generation time

Signup for the latest Gravity PDF news, tips and updates

  • This field is for validation purposes and should be left unchanged.
Scroll To Top

Choose your currency:

Converted prices are for reference only - all orders are charged in $ Australian Dollars ($) AUD.
  • AUDAustralian Dollars ($)
  • USDUS Dollars ($)
  • CADCanadian Dollars ($)
  • EUREuros (€)
  • GBPPound Sterling (£)
  • NZDNew Zealand Dollar ($)
  • JPYJapanese Yen (¥)