I have an advanced PDF template that currently loops through items from a search and shows 4 items per page. I am trying to get it to print each item based on the quantity (if there is quantity 3, print it 3 times) From what I have found, I think I can do it with <#list record.item as item>
I am also trying this:
<#assign qtycount = 0>
<#list results as result>
<#list 1..result.quantity>
<#assign qtycount++>
<#-- do actual printing of result content here -->
<#if qtycount % 4 == 0>
<pbr> <#-- page break -->
</#if>
</#list>
</#list>
<#list 1..item.quantity as i> but I am not sure how to implement it in this situation. Any help, pointers, or documentation is appreciated. Below is my current working advanced PDF.
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
<head>
<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
<#if .locale == "zh_CN">
<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
<#elseif .locale == "zh_TW">
<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
<#elseif .locale == "ja_JP">
<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
<#elseif .locale == "ko_KR">
<link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
<#elseif .locale == "th_TH">
<link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
</#if>
<style type="text/css">
body{ height:100%; margin: 0; padding: 0; }
html { height: 100%; margin: 0; padding: 0;}
</style>
</head>
<body padding="1in 0.45in 0.5in 0.75in" size="Letter"> <!-- Padding top right bottom left -->
<#list results?chunk(4) as page>
<#list page as result>
<table border="1" margin-right="0.2in" cellpadding="1" cellspacing="10" style=" height:4.5in; width:3.5in;" float="left">
<tr><td align="right">
<barcode bar-width="1" codetype="code128" showtext="true" value="${result.custcol_gsaitemreqnumber}XXX" />
</td></tr>
<#if result.custitem90?has_content>
<tr><td align="right">
<barcode bar-width="1" codetype="code128" showtext="true" value="${result.custitem90}" />
</td></tr>
<#else>
<tr><td align="right">
<barcode bar-width="1" codetype="code128" showtext="true" value="${result.itemid}" />
</td></tr>
</#if>
<tr><td align="right">
Cartridge, Toner ${result.manufacturer}
</td></tr>
<tr><td align="right">
${result.displayname}
</td></tr>
<tr><td align="right">
${result.quantity}: Each
</td></tr>
<tr><td align="right">
Cage Code: 0G4A2
</td></tr>
<tr><td align="right">
Contract Number: ${result.pricelevel}
</td></tr>
</table>
</#list>
<pbr />
</#list>
</body>
</pdf>