cancel
Showing results for 
Search instead for 
Did you mean: 

Invoice, shipment, credit memo PDFs: Remove Zend_Pdf, replace with html2pdf tool

Invoice, shipment, credit memo PDFs: Remove Zend_Pdf, replace with html2pdf tool

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.

 

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

 

(6)
8 Comments
Sander Mangel
Magento Master

Yes please! At the company I work for we've built an implementation with H4CC Wkhtmltopdf and Snappy php wrapper.

It works brilliantly and isn't too heavy on the server.

 

Also built in a caching layer saving the PDFs to S3 but that's just being fancy Smiley Wink

 

Right now in Magento 1 we've implemented the PDF's as the emails, with local templates and a variable engine generating the HTML, the actual PDF renderer (snappy) is ambiguous

john_fisheye
M2 Certified
+1 this would be a vast improvement over the current implementation
HirokazuNishi
Magento Master

It's not only font file. Printing some characters that consist of both single-byte and double-bytes, we have to calcluate each words width correctly. Otherwise they are sticking out from rectangle area!

And also Zend_Pdf can't generate PDF files without font file. So multibyte PDF (especially Chinese and Japanese) becomes huge size. 

avoelkl
M2 Certified

Just found another case where someone would be happy about a HTML invoice PDF:
http://magento.stackexchange.com/questions/154693/magento2-html-invoice

 

EaDesign
New Contributor

Hello all,

 

We have created https://github.com/EaDesgin/magento2-pdf-generator2 some time ago. Maybe will help somebody. 

Also supports right left  and asian fonts and languages but they are not implemented not implemented. 

PotatoCommerce
Occasional Contributor

 

Magento 2 PDF Customizer ← We have a solution Smiley Happy

 

With this extension, you can make flexible HTML+CSS so to create PDF templates. 

 

Features:

  • Support of HTML and CSS
  • Bulk printing of orders/invoices/shipments/credit memos/all
  • Admin, customer and guest PDF templates
  • Attach PDF files to sales emails
  • Free installation & free lifetime support

 

screenshot-1_1_4.png

 

Rohit Kashyap
Occasional Contributor

Hello Magento Community,

 

Please have a look at Magento 2 Invoice PDF Editor by Webkul, which allows the admin to customize and redesign templates in a few easy steps that include the drag and drop method and adding their own CSS as well.

 

Thanks,

Rohit.

iowebgr
Contributor

If you decide to do this avoid wkhtmltopdf. I've worked extensively with wkhtmltopdf due to using ERPNext which is using wkhtmltopdf and it's causing the following issue:

 

When you have a table cell that expands over a single page, and a repeating header, the header will overlap with the cell text on the following page. This can happen easily in some cases where you need to add a lot of information for an item and so far neither the wkhtmltopdf team nor the erpnext team was able to fix it. In other cases when the table row has to go in the following page but fits in a single page, the best you can do is actually avoid the break but this leaves huge spaces in the PDF before and after the offending row.

 

If you track the issue, you can find it's origins in the webkit rendering engine and it goes on for over 6 years.

 

I do know that tcpdf and other engines are tougher to use but they provide more consistent results than wkhtmltopdf