Announcement

Collapse
No announcement yet.

AP: printing quotes - generating tcpdf pagebreaks for long itemlists

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AP: printing quotes - generating tcpdf pagebreaks for long itemlists

    Hi,

    We need to print quotes landscape because we have lots of fields to print for every item. This way we risk to generate more than one page PDF and get the total amount table box we have at the end cutted in two parts as it spans over two different pages.

    So I'm wondering if there's a way to conditionally put a <br pagebreak="true"/> that forces tcpdf to go on another page, something that counts itemNum for example ... something like <!-- {{#if itemNum moreThan 10}} -->

    thanks a lot,
    Michele

  • #2
    Hello,
    for this create a bool notStorable field in Quote entityDefs (like breakPdfPage). In custom Quote service set this field in method loadAdditionalFieldsForPdf, and now you can use in on the template

    Comment


    • #3
      Originally posted by tanya View Post
      Hello,
      for this create a bool notStorable field in Quote entityDefs (like breakPdfPage). In custom Quote service set this field in method loadAdditionalFieldsForPdf, and now you can use in on the template
      Thanks Tanya, I've taken a look at that method you suggested but I don't understand exactly why you hinted at Quote entity...

      I saw that in loadAdditionalFieldsForPdf() there's a loop where is associated the itemList data list for htmlizer rendering of quote items. I could customize it and add a new unstorable field there, to Quote Item, for example, lastOfPage to set to 1 every 10 elements; so within the quote template, within the main itemList loop {{#if lastOfPage}} close table, pagebreak, new table {{/If}}. I'll let you know if this works...

      Michele

      Comment


      • #4
        Originally posted by tanya View Post
        Hello,
        for this create a bool notStorable field in Quote entityDefs (like breakPdfPage). In custom Quote service set this field in method loadAdditionalFieldsForPdf, and now you can use in on the template
        Hi Tanya,

        Thanks, it worked. I recap as maybe it can be usefull to others...

        - I added to QuoteItem entity definition a field like this:
        Code:
        "lastOfPage": {
                    "type": "bool",
                    "notStorable": true,
                    "default": false,
                    "disabled": true
                }
        that I can set in method loadAdditionalFieldsForPdf inside items loop when it's time to turn page and inside my template I catch it:

        Code:
        <!-- {{#if lastOfPage}} -->
              </tbody></table>
              <br pagebreak="true">
              <table class="table table-bordered" cellpadding="2" border="0.5pt">
          <tbody>
            <tr>
              <th>.. </th>
        
            </tr>
        <!-- {{/if}} -->
        Michele

        Comment


        • #5
          Hello, i dont really get how this should be implemented. Could you please provide me with a new description on how to do this?
          Thank you!

          Comment


          • #6
            My guess is you would use this code in your PDF Template because it look like a HTML code:

            <br pagebreak="true">

            Comment

            Working...
            X