community-features
community-features copied to clipboard
Replace Zend_Pdf with html2pdf tool
Top voted suggestion in Magento idea exchange forum: https://community.magento.com/t5/Magento-2-x-Feature-Requests-and/Invoice-shipment-credit-memo-PDFs-Remove-Zend-Pdf-replace-with/idi-p/45879
Given that the current invoice, shipment and credit memo PDFs look the same as in Magento 1 and PDF's are always a bit of a nightmare to customize for the merchants:
I suggest to replace the PDFs with a html2pdf tool. Actually the preview of the invoice looks already really nice in the backend, so this could just be converted to pdf.
Affected entities: Invoice, shipment, credit memo PDFs
This would maybe also help the problem Hirokazu Nishi mentioned in his tweet:
"Magento2 still use LinLibertine font. It’s only for Alphabets. To change PDF font, we still have to rewrite some classes..."
This idea resulted from a tweet/discussion here: https://twitter.com/hirokazu_nishi/status/770282916819578881 https://twitter.com/rescueAnn/status/770338589326635008 https://twitter.com/benmarks/status/770339381995384832
Another option from https://github.com/magento/community-features/issues/89
Problem
Magento uses the Zend_Pdf library to generate PDFs for order, invoice etc. This makes it really difficult to modify the PDF template without writing preferences to the actual classes and doing pixel-specific calculations
Proposed Solution
The PDFs should be rendered from HTML using any tool like dompdf to convert the HTML to PDF. This HTML should again, be using a layout handle, like order_invoice_pdf
where the current invoice should be passed as a Registry Item, making it a lot easier to modify the PDFs
Open in April 2018 and we are the 30 July 2024 ... :face_exhaling: