9

is there a best practice to create e new custom e.g. invoice PDF?

I need a separate custom PDF with my own layout and tables.
And here is my problem: I had never created a PDF in Magento before so there are many questions where and how to start with this.

The only thing I have is a new module with models and a collection.

Do I need phtml files for my template or does it belong into a model with Zend_Pdf?

2 Answers 2

1

I encourage anyone looking to customize their PDF printouts to check out the Comwrap_Pdf module. It takes a different approach to rendering PDFs in that they are created using regular HTML and CSS (in a Magento phtml template), then a PDF is created from that HTML using the MPDF library.

Building PDFs this way is much simpler than having to worry about re-flows, wrapping text, and coordinate-based rendering like Zend_PDF.

0

We implemented FireGento_Pdf. It helps a lot to implement your own Engine to make the pdf as you want it. Have a look on it:

https://github.com/firegento/firegento-pdf

2
  • Looks nice but there are some dependecies as I can see. Would be nice not to install a bunch of packages. And how have you created your own templates? I guess that Firegento uses also a rigid template. Do I have to customize that or is there a way to draw my own structure and say Firegento / Magento to use this templatestructure? Commented May 5, 2015 at 14:12
  • No templates, you can only use your own engine as described here: github.com/firegento/firegento-pdf/wiki/… If you want really cool templates and stuff, you should search for html/css to pdf renderer, I heard lots of cool things about it, but unfortunately I have no reference. Commented May 5, 2015 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.