RE: Advanced PDF Error

Hi All,

I am fairly new to Netsuite (couple months of experience), but i am running into a problem which i can’t replicate in between sandbox and production.

I created a custom template for the sales order which worked in sandbox and production. It still works in production but it does not work for any of the sales orders created in sandbox.

The error i receive is;

The template cannot be printed due to the following errors:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0java.lang.InternalError: java.lang.StringIndexOutOfBoundsException: String index out of range: 0Please contact your administrator.

I do not know how to debug advanced PDF templates.

What i did was remove different parts such as the header, line information en footer to debug in sandbox but the error still returns. The error does not say on which field it gives the error. Has anybody any idea? My last resort is a sandbox refresh.

 

Code of the template;

<?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>

<macrolist>

<macro id="nlheader">

<table style="width: 100%; font-size: 10pt;"><tr>

<td rowspan="3" style="padding: 0;"><#if companyInformation.logoUrl?length != 0></#if><span style="font-size: 20pt;">${record@title}</span><br /><br /><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${subsidiary.mainaddress_text}</span></span></td>

<td align="right" rowspan="3" style="padding: 0;"><img src="${subsidiary.logo@url}" style="float: right; height: 33%; width: 33%;" /><br />&nbsp;</td>

</tr></table>

</macro>

<macro id="nlfooter">

<table class="footer" style="height:100%;width:100%;">

<tr>

<td align="center"><img src="${subsidiary.custrecord_sd_subsidiary_footer_img@url}" style="float: center; width: 12%; height: 10%;" /><br/></td>

</tr>

<tr>

<td align="right" style=""><pagenumber/> of <totalpages/></td>

</tr>

</table>

</macro>

</macrolist>

<style type="text/css">* {

<#if .locale == "zh_CN">

font-family: NotoSans, NotoSansCJKsc, sans-serif;

<#elseif .locale == "zh_TW">

font-family: NotoSans, NotoSansCJKtc, sans-serif;

<#elseif .locale == "ja_JP">

font-family: NotoSans, NotoSansCJKjp, sans-serif;

<#elseif .locale == "ko_KR">

font-family: NotoSans, NotoSansCJKkr, sans-serif;

<#elseif .locale == "th_TH">

font-family: NotoSans, NotoSansThai, sans-serif;

<#else>

font-family: NotoSans, sans-serif;

</#if>

}

table {

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;

}

td p { align:left }

</style>

</head>

<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="A4">

<table style="width: 100%; margin-top: 10px;"><tr>

<td colspan="3" style="font-size: 8pt; padding: 6px 0 2px; color: #333333;"><span style="color:#999999;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${record.billaddress@label}</span></span></span></td>

<td colspan="3" style="font-size: 8pt; padding: 6px 0px 2px; color: rgb(51, 51, 51); width: 256px;"><span style="color:#999999;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${record.shipaddress@label}</span></span></span></td>

<td rowspan="1" style="font-size: 8pt; padding: 6px 0px 2px; color: rgb(51, 51, 51); width: 185px;"><span style="color:#999999;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${record.tranid@label}</span></span></span></td>

<!--<td colspan="5" style="font-size: 12pt; background-color: #e3e3e3; font-weight: bold;">${record.total@label?upper_case}</td>--></tr>

<tr>

<td colspan="3" style="padding: 0;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="font-size:10px;">${record.billaddress}</span></span></td>

<td colspan="3" style="padding: 0px; width: 256px;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${record.shipaddress}</span></span></td>

<td rowspan="1" style="padding: 0px; width: 185px;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${record.custbody_pwks_remote_order_name}</span></span></td>

</tr></table>
<table style="width: 100%; margin-top: 10px;"><tr><#if record.otherrefnum?has_content>

<td><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="color:#999999;">${record.otherrefnum@label}</span></span></span></td>

</#if>

<td><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="color:#999999;">${record.shipdate@label}</span></span></span></td>

</tr>

<tr><#if record.otherrefnum?has_content>

<td style="padding-top: 2px;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="font-size:10px;">${record.otherrefnum}</span></span></td>

</#if>

<td style="padding-top: 2px;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="font-size:10px;">${record.shipdate}</span></span></td>

</tr></table>

<#if record.item?has_content>
<table style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item><#if item_index==0>

<thead>

<tr>

<th align="center" colspan="3" style="padding: 10px 6px;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.quantity@label}</span></span></th>

<th colspan="12" style="padding: 10px 6px;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.item@label}</span></span></th>

<th colspan="6" style="padding: 10px 6px;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="font-size:10px;">${item.options@label}</span></span></th>

<th align="right" colspan="4" style="padding: 10px 6px;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.rate@label}</span></span></th>

<th align="right" colspan="4" style="padding: 10px 6px;"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.amount@label}</span></span></th>

</tr>

</thead>

</#if><tr>

<td align="center" colspan="3" line-height="150%"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.quantity}</span></span></td>

<td colspan="12"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="font-weight: bold; line-height: 150%; color: #333333;">${item.item}</span></span></span><br /><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.description}</span></span></td>

<td colspan="6"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.options}</span></span></td>

<td align="right" colspan="4"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.custcol_sd_sales_grossrate}</span></span></td>

<td align="right" colspan="4"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${item.grossamt}</span></span></td>

</tr>

</#list><!-- end items --></table>
<hr style="width: 100%; color: #d3d3d3; background-color: #d3d3d3; height: 1px;" /></#if>

<table style="page-break-inside: avoid; width: 100%; margin-top: 10px;"><tr style="line-height: 200%;">

<td colspan="4">&nbsp;</td>

<td align="right" style="font-weight: bold; color: #333333;"><span style="font-family:Verdana,Geneva,sans-serif;">${record.total@label}</span></td>

<td align="right"><span style="font-family:Verdana,Geneva,sans-serif;">${record.total}</span></td>

</tr>

<tr>

<td background-color="#ffffff" colspan="4">&nbsp;</td>

<td align="right" style="color: #333333;"><span style="color:null;"><span style="font-family:Verdana,Geneva,sans-serif;"><span style="font-size:10px;">${record.taxtotal@label} (${record.custbody_sd_taxrate}%)</span></span></span></td>

<td align="right"><span style="font-size:10px;"><span style="font-family:Verdana,Geneva,sans-serif;">${record.taxtotal}</span></span></td>

</tr></table>

</body>

</pdf>
JackDekker Rookie Asked on January 6, 2020 in SuiteScript.
Add Comment
2 Answers

From my experience:

  • Check the logic and reference to Logo/Url fields. (existing?      subsidiary.custrecord_sd_subsidiary_footer_img@url)
  • replace special characters when referencing Url.

 

<#if companyInformation.logoUrl?length != 0></#if><span style=”font-size: 20pt;”>${record@title}</span><br /><br /><span style=”font-size:10px;”>

<span style=”font-family:Verdana,Geneva,sans-serif;”>${subsidiary.mainaddress_text}</span></span></td>
<td align=”right” rowspan=”3″ style=”padding: 0;”><img src=”${subsidiary.logo@url}” style=”float: right; height: 33%; width: 33%;” /><br />&nbsp;</td>

<td align=”center”><img src=”${subsidiary.custrecord_sd_subsidiary_footer_img@url}” style=”float: center; width: 12%; height: 10%;” /><br/></td>

 

 

 

Rookie Answered on February 16, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.