RE: Items labels using Advanced PDF and Saved search
Hey everyone,
I am trying to print Item labels using an advanced PDF. I am literally using a code provided by Netsuite on Suiteanswers but I am getting an error. I am new to advanced PDFs so if someone can assist me, it would be awesome. Here’s the code:
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd"> <pdf> <head> <#if .locale == "ru_RU"> <link name="verdana" type="font" subtype="opentype" src="${nsfont.verdana}" src-bold="${nsfont.verdana_bold}" bytes="2" /> </#if> <style type="text/css">table { <#if .locale == "zh_CN"> font-family: stsong, sans-serif; <#elseif .locale == "zh_TW"> font-family: msung, sans-serif; <#elseif .locale == "ja_JP"> font-family: heiseimin, sans-serif; <#elseif .locale == "ko_KR"> font-family: hygothic, sans-serif; <#elseif .locale == "ru_RU"> font-family: verdana; <#else> font-family: sans-serif; </#if> font-size: 9pt; table-layout: fixed; } th { font-weight: bold; font-size: 8pt; vertical-align: middle; padding: 5px 6px 3px; background-color: #e3e3e3; color: #333333; } td { padding: 4px 6px; } </style> </head> <body padding="0.5in 0.5in 0.5in 0.5in" size="Letter"> <#if results?size != 0><#list results as result> <table border="1" cellpadding="1" cellspacing="1" style="width: 500px;"><tr> <td><b>Serial number</b></td> <td><b>Display name</b></td> </tr> <tr><#if result.serialnumber?length != 0> <td><barcode codetype="code128" showtext="true" value="${result.serialnumber}"/></td></#if> <td>${result.displayname?string}</td> </tr> </table></#list></#if> </body> </pdf> And this is the error: Exception during template merging.com.netledger.templates.TemplateServiceException: Exception during template merging.java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 3 Thank you in advance for any help you can provide!
Hi,
Just to narrow down the issue, could you please give this a try:
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd"> <pdf> <head></head> <body padding="0.5in 0.5in 0.5in 0.5in" size="Letter"> <#if results?size != 0> <#list results as result> <table border="1" cellpadding="1" cellspacing="1" style="width: 500px;"> <tr> <td><b>Serial number</b></td> <td><b>Display name</b></td> </tr> <tr> <#if result.serialnumber?length != 0> <td><barcode codetype="code128" showtext="true" value="${result.serialnumber}"/></td> </#if> <td>${result.displayname?string}</td> </tr> </table> </#list> </#if> </body> </pdf>
Thanks,
Chris
I don’t think this template is ideal but let’s see if we can get it to display at all before we worry about that.
Hey Chris!
Thank you for your answer. What you sent created the same issue but I figured out what the problem was. The saved search that was created was done with item name and not display name, so when we were trying to get display name without the field being present on the search, it was giving an error.