GravityPDF / gravity-pdf

Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using Gravity Forms.
https://gravitypdf.com
88 stars 21 forks source link

Only allow a maximum of 8 User-Defined CSS Classes in Core Templates #1425

Closed jakejackson1 closed 1 year ago

jakejackson1 commented 1 year ago

Description There is a significant memory problem in mPDF when a HTML tag has a lot of classes. To reduce the risk of this occurring in Gravity PDF we should limit the $field->cssClass property to a maximum of 10 classes.

Step To Reproduce Steps to reproduce the behavior:

  1. Add 25 unique classes to the Custom CSS Class setting in a field in the Form Editor
  2. Setup a Core template on the form
  3. Attempt to view the PDF
  4. Get memory exhausted error

Expected behavior The PDF to generate without any errors

Additional context Per the issue upstream in mPDF, there isn't a simple fix to this problem. The only workaround I can think of at the moment is to try limit the number of CSS classes that are added to a HTML tag.