PDF printing coding language

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esendino
    Senior Member
    • May 2019
    • 158

    PDF printing coding language

    Hello.

    in the documentation on how to encode PDFs there seem to be two versions.

    In https://www.espocrm.com/documentatio...-each-iterator

    there is this example:


    <table>
    <!-- {{#each itemList}} -->
    <tr>
    <td>{{name}}</td>
    </td>{{amount}}</td>
    </tr>
    <!-- {{/each}} -->
    </table>

    In https://www.espocrm.com/documentatio...content-tables there is this other coding

    {{#tableTag width="80%" border="0.5pt" cellpadding="4"}}
    {{#each opportunities}}
    {{#trTag}}
    {{#tdTag width="40%"}}{{name}}{/tdTag}}
    {{#tdTag width="30%"}}{{assignedUserName}}{/tdTag}}
    {{#tdTag width="30%" align="right"}}{{stage}}{{/tdTag}}
    {{/trTag}}
    {{/each}}
    {{/tableTag}}

    the differences on how to code are manifold:

    In the first case {{ is used only in some instructions and those with <!--
    The # is incorporated in all instructions
    the Tag suffix is used. This is the only thing that is mentioned. Nothing said on the other two issues

    i have my templates coded as the first versions and they work perfectly, but I see the second is recommended

    I would like to know if you can use both versions of the code indistinctly or I must update my templates

    Best regards

    PD Example of one of my codings:

    {{! LISTA DE LAS CAJAS BOXSPACE}}
    <table width="100%" border="1px solid black" cellpadding="3" class="table table-bordered">
    <thead>
    <tr style="background-color:#085294;color:#FFFFFF;">
    <td colspan="5" align="center"><b>CAJAS BOXSPACE</b></td>
    </tr>
    <tr style="font-size:10pt; background-color:#085294;color:#FFFFFF;">
    <td width="10%" align="center" style="font-weight: bold;">Campo 1<br>Pedido</td>
    <td width="35%" align="center" style="font-weight: bold;">Campo 2<br>Cód. UniBox</td>
    <td width="20%" align="center" style="font-weight: bold;">Campo 3<br>Referencia</td>
    <td width="35%" align="center" style="font-weight: bold;">Campo 4<br>Tipo</td>
    </tr>
    </thead>
    <tbody>
    <!-- {{#each lGOrdenLineas}} -->
    <!-- {{#if lGSuscripcionDescripcion}} -->
    <!-- {{else}} -->
    <tr style="font-size:10pt;">
    <td width="10%" align="center">{{../name}}</td>
    <td width="35%"> </td>
    <td width="20%" align="center">{{lGSuscripcion}}</td>
    <td width="35%">{{lGTipoProducto}}</td>
    </tr>
    <!-- {{/if}} -->
    <!-- {{/each}} -->
    </tbody>
    </table>


    {{! LISTA DEL RESTO DE COSAS}}
    <table width="100%" border="1px solid black" cellpadding="3" class="table table-bordered">
    <thead>
    <tr style="background-color:#085294;color:#FFFFFF;">
    <td colspan="5" align="center"><b>OTROS PRODUCTOS DEL PEDIDO</b></td>
    </tr>
    <tr style="font-size:10pt; background-color:#085294;color:#FFFFFF;">
    <td width="10%" align="center" style="font-weight: bold;">Campo 1<br>Pedido</td>
    <td width="35%" align="center" style="font-weight: bold;">Campo 2<br> Cód. UniBox</td>
    <td width="20%" align="center" style="font-weight: bold;">Campo 3<br>Referencia</td>
    <td width="35%" align="center" style="font-weight: bold;">Campo 4<br>Descripción</td>
    </tr>
    </thead>
    <tbody>
    <!-- {{#each lGOrdenLineas}} -->
    <!-- {{#if lGSuscripcionDescripcion}} -->
    <tr style="font-size:10pt;">
    <td width="10%" align="center">{{../name}}</td>
    <td width="35%"> </td>
    <td width="20%" align="center">{{lGSuscripcion}}</td>
    <td width="35%">Otros: {{lGSuscripcionDescripcion}}</td>
    </tr>
    <!-- {{/if}} -->
    <!-- {{/each}} -->
    </tbody>
    </table>
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    No need to update. The second way was introduced later as an easier way to define tables.
    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

    • esendino
      Senior Member
      • May 2019
      • 158

      #3
      Thanks

      Comment

      • crmclients
        Senior Member
        • Jul 2020
        • 254

        #4
        @esendino
        can you please share how you did it the normal way? can find many <table> <td> <tr>examples
        however the data doesn't show in the PDF Template, just the code

        the (tagtable) method shows data but won't space correctly and all the fields print on top of each other - there doesn't seem to be a reference document for how (tagtable) works, just epso forum comes up in the search...

        Comment

        Working...