PDF Template Creation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ashif Malayil
    Senior Member
    • Dec 2023
    • 171

    PDF Template Creation

    As of now it's really hard to create a PDF Template of our Organisation (Invoice, Quotes), Column and Row arrangement and merging is the hectic thing to do? Is there any way to create those by coding or any other PDF Generator is there?
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    You have two possibilities regarding PDF (assuming you use the most recent version of espoCRM):

    1. TCPDF engine. This was the enginge used a long time until version 8. If you want to use it, you need the free extension from espoCRM for TCPDF. This engine is still supported because of the many installations, that have lots of TCPDF templates. Use it only if you already have lots of templates created with this engine.
    2. DOMPDF engine. This is the new engine, which now is the default engine. DOMPDF has several advantages. Use it, if you did not start anything with TCPDF.

    Creating templates ist made by a template language called handlebars. In espoCRM there are integrated a lot of helpers, which make it possible - with some learning - to create quite decent templates. Once you understood the caveats of the engines and the template language, it is not so difficult to create, what you need. All fields are integrated by placeholders, be aware of using them correctly.

    Some advice:
    Do not use WYSIWYG mode in creating templates, it is recommended to use the code view. In most cases you will get along with HTML, in case of DOMPDF also CSS. TCPDF are created more with HTML tables. The language Handlebars provides a lot of possibilities to print out the fields, relationships, has ifThen possibilities and other stuff, that you will find in the espoCRM manual. https://docs.espocrm.com/user-guide/printing-to-pdf/

    Because the templates mainly are HTML I recommend to create them in an editor and copy the result into the code view of the template. Be aware, that after saving a template, the code maybe stripped sometimes of unallowed tags. This is something to learn. The editor in espoCRM sometimes also behaves strange, so on any error or the template not looking as expected, check the code. You will need quite good HTML knowledge.

    Once you created a template you may copy working code from one template to another. This often happens, when you create several templates for a company. Adress fields, all over design etc. will be identical for several templates and so you will proceed faster.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8438

      #3
      It's getting better:Unless one needs a very fancy looking PDF, considering some HTML and CSS knowledge, it should be not difficult to markup a template.

      If very fancy PDF is needed, here we can face with limitations of the PDF engine.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1602

        #4
        seems its getting time to adapt all my templates to DOMPDF ......

        Comment

        Working...