🔥 Gravity PDF v3 end of life was 2017-06-20 and this version is no longer supported. This legacy documentation is kept for reference only.
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.phpfile which is located in the
- If your template uses large tables, you can set
- Another option is to set
truewhich 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 -
truewill strip out some of the more advanced features from the package such as complex table borders, terms and conditions, columns, index, bookmarks and barcodes.
- As a last resort you can try set
truewhich 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.
- 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.
- 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.
- Instead of using HTML attributes to format the PDF you should use CSS styles.
- Don’t use the CSS property “overflow” as it will slow down the PDF generation time