function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Priya 777Priya 777 

Hi Need help on this PDF generator

I have a table where it creates PDF depends on number of values , i would like to generate this  in a way that i have to push the few of the values to next page and show it with Subtotal and Discounted Total estimated charges on one page when the values are like this .Do i have to use a specific format for this ?

<?xml version="1.0" encoding="UTF-8"?>
<template pageSize="LETTER" pageOrientation="portrait" pageMargins="40 60 40 50" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="fx-report-schema_1_0.xsd">
  <header>
    <table marginLeft="50" marginTop="20" border="false false false false" columnWidths="*">
    <tableBody>
        <row>
      <cell style="header-footer"  border="false false false false"><image width=
      </image></cell>
        </row>
        </tableBody></table>
  </header>

  <body>
    <table marginTop="30" columnWidths="110 150 * 90">
      <tableBody>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">Customer:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.FX5__CustomerAccount__r.Name}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false">Field Ticket No:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{Name}}</cell>
        </row>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">Customer Field Rep:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{Customer_Printed_Name__c}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false">Service District:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.FX5__Office__r.Short_Company_Name__c}}</cell>
        </row>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">Well Name:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.Well_Name_Report__c}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false">Service Line:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.RecordType.Name}}</cell>
        </row>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">Field:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.Field__c}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false">Date:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{formatDate FX5__Ticket_Date__c format="MM/DD/YY"}}</cell>
        </row>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">County, State:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.County_Parish_State__c}}  {{FX5__Job__r.Well_Zip_Code__c}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false">Sales Representative:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.Sales_Contact__r.Name}}</cell>
        </row>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">API Number:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.Well_API__c}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false">District Representative:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.District_Representative__r.Name}}</cell>
        </row>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">Job Type:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{FX5__Job__r.SAP_Job_Type__c}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false">C&amp;J Field Representative:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{C_J_Field_Representative_1a__r.FirstName}}  {{C_J_Field_Representative_1a__r.LastName}}</cell>
        </row>
        <row>
            <cell fontSize="10" bold="true" border="false false false false">CT Unit:</cell>
            <cell fontSize="10" bold="false" border="false false false false">{{Fleet_or_Unit__c}}</cell>
            <cell alignment="right" fontSize="10" bold="true" border="false false false false"></cell>
            <cell fontSize="10" bold="false" border="false false false false"></cell>
        </row>
      </tableBody>
    </table>
{{#filter FX5__Ticket_Items__r "Exclude_from_Customer_Reports__c" is=false}}
       {{#group items "Report_Category__c" desc=false sort="Report_Category_Order__c"}}   
       {{#if items.length}}
      
          <table marginTop="10" columnWidths="35 * 35 45 40 40 50 60">
            <tableBody>
            <row>
                <cell alignment="center" bold="true" fillColor="#D9D9D9" fontSize="10" colSpan="8">{{Report_Category__c}} Items</cell>
              <emptyCell></emptyCell>
              <emptyCell></emptyCell>
              <emptyCell></emptyCell>
              <emptyCell></emptyCell>
              <emptyCell></emptyCell>
              <emptyCell></emptyCell>
              <emptyCell></emptyCell>
            </row>
            <row >
              <cell bold="true" alignment="left" fillColor="#D9D9D9" fontSize="8">Item #</cell>
              <cell bold="true" alignment="center" fillColor="#D9D9D9" fontSize="8">Description</cell>
              <cell bold="true" alignment="center" fillColor="#D9D9D9" fontSize="8">Qty</cell>
              <cell bold="true" alignment="center" fillColor="#D9D9D9" fontSize="8">Price</cell>
              <cell bold="true" alignment="center" fillColor="#D9D9D9" fontSize="8">UOM</cell>
              <cell bold="true" alignment="center" fillColor="#D9D9D9" fontSize="8">Discount</cell>
              <cell bold="true" alignment="center" fillColor="#D9D9D9" fontSize="8">Gross</cell>
              <cell bold="true" alignment="center" fillColor="#D9D9D9" fontSize="8">Net</cell>
            </row>
        
            {{#each items}}    
              <row >
                <cell alignment="left" fontSize="8">{{FX5__Item_Code__c}}</cell>
                <cell alignment="left" fontSize="8">{{FX5__Description__c}}</cell>
                <cell alignment="center" fontSize="8">{{FX5__Input_Qty__c}}</cell>
                <cell alignment="right" fontSize="8">{{formatCurrency FX5__Price__c symbol="$" precision="2" separator="," decimal="."}}</cell>
                <cell alignment="center" fontSize="8">{{Catalog_Item_UOM__r.Name}}</cell>
                <cell alignment="center" fontSize="8">{{formatPercent FX5__Discount_Percent__c decimalPlaces=2}}</cell>
                <cell alignment="right" fontSize="8">{{formatCurrency Subtotal__c symbol="$" precision="2" separator="," decimal="."}}</cell>
                <cell alignment="right" fontSize="8">{{formatCurrency Extended_Amount__c symbol="$" precision="2" seperator="," decimal="." }}</cell>
              </row>
            {{/each}}
           
            <row >
              <cell fillColor="#D9D9D9" italics="true" color="black" bold="true" fontSize="9" colSpan="7" alignment="right">Subtotal:</cell>
              <emptyCell fillColor="#D9D9D9"></emptyCell>
              <emptyCell fillColor="#D9D9D9"></emptyCell>
              <emptyCell fillColor="#D9D9D9"></emptyCell>
              <emptyCell fillColor="#D9D9D9"></emptyCell>
              <emptyCell fillColor="#D9D9D9"></emptyCell>
              <emptyCell fillColor="#D9D9D9"></emptyCell>
              <cell fillColor="#D9D9D9" alignment="right" color="black" bold="true" fontSize="9">{{sum items "Extended_Amount__c" symbol="$" precision="2" seperator="," decimal="."}}</cell>
            </row>
            </tableBody>
        </table>
  {{/if}}
            {{/group}}
            {{/filter}}     
    <table columnWidths="* 60" marginTop="10">
      <tableBody>
        <row>
          <cell fillColor="#D9D9D9" fontSize="9" bold="true" alignment="right" italics="true">Discounted Total Estimated Charges</cell>
          <cell fillColor="#D9D9D9" fontSize="9" bold="true" alignment="right">${{sum FX5__Ticket_Items__r "Extended_Amount__c"}}</cell>
        </row>
          <row>
              <cell border="false false false false" colSpan="2" fontSize="7">This is a cost estimate only.  Actual charges are to based on equipment, chemicals, materials, and personnel required to complete the job. This does not include sales tax or well services tax that may be included at the time of invoicing.</cell>
              <emptyCell></emptyCell>
          </row>
      </tableBody>
    </table>



User-added image
Durai SaravananDurai Saravanan
Hi Priya,

Good day!

Yes, you can do that by rendering 'Page Break' conditionally. If the table row count exceeds particular value(based on requirment), insert page break

Thanks and regards
Durairaj