Details
-
Type:
Improvement
-
Status: Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 3.0.0
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
Blesta uses TCPDF to render PDF documents. One problem with this is that in order to support the widest range of characters as possible, Blesta defaults to using the dejavusans font. Due to the architecture PDF, UTF-8 fonts must be embedded within the document, and this results in much larger sized documents.
TCPDF has a feature (in version 6.0.072, possibly older), that allows embedding only characters in the document that are used within the document (part of TCPDF::SetFont(); $subset parameter). However, TCPDF is a monstrosity (24K lines of code, 870 KB+ single file) that may cause more problems than it solves.
One of two things that can be done:
- Update TCPDF to take advantage of this feature.
- Switch to a different PDF rendering library. ZendPDF may be an option, though it doesn't look very good.
One possible other option, though I'd hate to do this, is to patch our existing vendor copy of TCPDF to include the partial embed font feature.
Patching TCPDF may actually be the best option. I base this on two primary factors:
1. We're unlikely to upgrade TCPDF due to the issues we had in a previous attempt which may break our current invoices, and don't want an even more bloated library than we currently have. If I recall, we had major issues embedding images into the background.
2. Patching TCPDF is unlikely to introduce new issues to our PDF templates, which switching to a new library would require us to rewrite.
If we're stuck with TCPDF (which still seems like the best option, despite its shortcomings) and we aren't going to upgrade the library, we should patch it.