I'm using barryvdh/laravel-dompdf v2.0.1 which is a wrapper of dompdf and I'm having the following issue:
When adding any checkbox to a pdf the generated file multiplies its size, memory consumption and time to process the file. Previously everything was working fine, with my file having around 20KB of space, processed in about 100ms and now it takes almost 1MB and is processed in about 1 entire second. There are no errors, the document apparently looks the same but the file size is enormous now.
I've tested generating a new file just with a single checkbox and these are the results using Postman:
In production I produce pdf reports that are sent by email and everything used to work perfectly until complaints started to come about the size of the attachments, that's when I found out the problem.
My composer packages are updated regularly so I think that something got broken.
Is this a bug on dompdf or is it something that can be fixed on my own code/configuration?
I'm using Laravel 10.
I've found the solution here thanks to glinda93:
https://stackoverflow.com/a/66275492/2789730
At the config/dompdf.php file change the following property to true:
"enable_font_subsetting" => true,
The problem was with the font-family that should be Dejavu. See https://github.com/dompdf/dompdf/issues/3189
With this solution not only the checkbox and other form fields are rendered correctly but the PDF filesize is reduced significantly to a reasonable size.