Hello Monks

I've been using PDF::Template Module to generate PDF based on my input datahash. Please check the working code below

I want to generate one more set of data in another page without changing the XML File. As data comes dynamically I'm not sure of how many times I must include the LOOP attribute in my XML File

Any ideas or suggestions are appreciated. Many Thanks

use strict; use PDF::Template; my $rpt = new PDF::Template( FILENAME => 'sample.xml' ); my %Inputs = ( 'svctype' => 'Voice', 'fromcur' => 'EUR', 'LOOPDETAIL2' => [ { 'seqnum' => 878, 'date' => '01-Apr-2010', 'tax' => '0.000', 'posttax' => '0.000', 'pretax' => '0.000', 'israp' => 'FALSE' }, { 'seqnum' => 879, 'date' => '02-Apr-2010', 'tax' => '0.000', 'posttax' => '0.000', 'pretax' => '0.000', 'israp' => 'FALSE' }, { 'seqnum' => 880, 'date' => '03-Apr-2010', 'tax' => '0.000', 'posttax' => '0.000', 'pretax' => '0.000', 'israp' => 'FALSE' }, ], 'pretax_totals' => '0.000', 'tax_total' => '0.000', 'posttax_totals' => '0.000', ); $rpt->param(%Inputs); $rpt->write_file('/export/home/kars/sample.pdf');

Input XML File is as follows

<pdftemplate name="test"> <pagedef margins="1i" pagesize="A4" nopagenumber="0"> <font face="Helvetica" h="10"> <if name="svctype" op="ne" value="SMS"> <font face="Helvetica-Bold"> <row> <textbox w="100%" h="*2" text=""/> </row> <row h="*1.5"> <textbox w="20%" border="1" justify="center">D +ate</textbox> <textbox w="20%" border="1" justify="center">S +equence Number Range</textbox> <textbox w="20%" border="1" justify="center">P +re-Tax Value in <var name="fromcur"/> </textbox> <textbox w="20%" border="1" justify="center"> + Tax Value in <var name="fromcur"/> </textbox> <textbox w="20%" border="1" justify="center">P +ost-Tax Value in <var name="fromcur"/> </textbox> </row> </font> <loop name="LOOPDETAIL2"> <row h="*1.5"> <if name="israp" op="eq" value="FALSE"> <textbox w="20%" border="1" justify="cente +r" text="$date"/> <textbox w="20%" border="1" justify="cente +r" text="$seqnum"/> <textbox w="20%" border="1" justify="right +" text="$pretax"/> <textbox w="20%" border="1" justify="right +" text="$tax"/> <textbox w="20%" border="1" justify="right +" text="$posttax"/> </if> </row> </loop> <font face="Helvetica-Bold"> <row h="*1.5"> <textbox w="20%" border="1" justify="center" t +ext=""/> <textbox w="20%" border="1" justify="center" t +ext="Total"/> <textbox w="20%" border="1" justify="right" te +xt="$pretax_totals"/> <textbox w="20%" border="1" justify="right" te +xt="$tax_total"/> <textbox w="20%" border="1" justify="right" te +xt="$posttax_totals"/> </row> </font> </if> </font> </pagedef> </pdftemplate>

In reply to PDF::Template - Create cascade PDF by kalyanrajsista

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.