RE: PDF Template Error Message
Hello,
I’ve been using a working PDF template and it’s suddenly stopped working. When I go to preview the template I get the following error:
Exception during template merging.com.netledger.templates.TemplateServiceException: Exception during template merging.java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 18
Can someone tell me what the nature of this error is? I’m sure I didn’t make any code changes much less save anything, so I’m not sure where to start debugging.
Thanks a lot in advance!
Please paste your code. thank you!

<?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”>table { font-size: 9pt; table-layout: fixed; width: 100%; }
th { font-weight: bold; font-size: 8pt; vertical-align: middle; padding: 5px 6px 3px; background-color: #e3e3e3; color: #333333; padding-bottom: 10px; padding-top: 10px; }
td { padding: 4px 6px; }
b { font-weight: bold; color: #333333; }
<!– border-collapse CSS property –>
#collapseTable {
border-collapse: collapse;}
table, td, th {
border-bottom: 1px solid black;
}
</style>
}
</head>
<body padding=”0.5in 0.5in 0.5in 0.5in” size=”A3-LANDSCAPE”>
<table><tr>
<td><img src=”https://3521502.app.netsuite.com/core/media/media.nl?id=3254&c=3521502&h=e8886ab1d01c283bad3e&fcts=20181114082023&whence=” style=”width: 164px; height: 75px;” /><strong><span style=”font-size:26px;”>Bi-Weekly Status Report – ${.now?date} </span></strong></td>
<td style=”text-align: center;”> </td>
</tr>
<tr>
<td>Prepared by: Connor Fray | Connor.fray@ecochlor.com | 203.216.7869</td>
</tr></table>
<table><#list results as result><#if result_index == 0>
border-collapse: collapse
<thead >
<tr>
<th style=”width: 95px; “>
<p style=”text-align: left;”>${result.entityid@label}</p>
</th>
<th style=”width: 95px; “>
<p style=”text-align: left;”>${result.companyname@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_pfdate@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_ftdate@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_fsdate@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_filter_location@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_gapdate@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity1@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.formuladate@label}</p>
</th>
<th style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_drydock@label}</p>
</th>
<th style=”width: 250px; “>
<p style=”text-align: left;”>${result.custentity_proj_readiness_report_status@label}</p>
</th>
</tr>
</thead>
</#if>
border-collapse: collapse
<tr style=”background-color: ${((result_index % 2)==0)?string(‘#ffffff’, ‘#e3e3e3’)};”> ”>>
<td style=”width: 95px; “>
<p style=”text-align: left;”>${result.entityid}</p>
</td>
<td style=”width: 95px; “>
<p style=”text-align: left;”>${result.companyname}</p>
</td>
<#if result.custentity_ecochlor_pfdate?has_content && result.custentity1?has_content && result.custentity_ecochlor_pfdate gt result.custentity1>
<td style=”width: 110px; font-weight: bold; color: #ff0000 ; background-color: #FFFF00″> <p style=”text-align: left;”>${result.custentity_ecochlor_pfdate}</p></td><#else>
<td style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_pfdate}</p>
</td></#if>
<#if result.custentity_ecochlor_ftdate?has_content && result.custentity1?has_content && result.custentity_ecochlor_ftdate gt result.custentity1>
<td style=”width: 110px; font-weight: bold; color: #ff0000 ; background-color: #FFFF00″> <p style=”text-align: left;”>${result.custentity_ecochlor_ftdate}</p></td><#else>
<td style=”width: 110px;”>
<p style=”text-align: left;”>${result.custentity_ecochlor_ftdate}</p>
</td></#if>
<#if result.custentity_ecochlor_fsdate?has_content && result.custentity1?has_content && result.custentity_ecochlor_fsdate gt result.custentity1>
<td style=”width: 110px; font-weight: bold; color: #ff0000 ; background-color: #FFFF00″> <p style=”text-align: left;”>${result.custentity_ecochlor_fsdate}</p></td><#else>
<td style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_fsdate}</p>
</td></#if>
<td style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_filter_location}</p>
</td>
<#if result.custentity_ecochlor_gapdate?has_content && result.custentity1?has_content && result.custentity_ecochlor_gapdate gt result.custentity1>
<td style=”width: 110px; font-weight: bold; color: #ff0000 ; background-color: #FFFF00″> <p style=”text-align: left;”>${result.custentity_ecochlor_gapdate}</p></td><#else>
<td style=”width: 110px;”>
<p style=”text-align: left;”>${result.custentity_ecochlor_gapdate}</p>
</td></#if>
<td style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity1}</p>
</td>
<td style=”width: 110px; “>
<p style=”text-align: left;”>${result.formuladate}</p>
</td>
<td style=”width: 110px; “>
<p style=”text-align: left;”>${result.custentity_ecochlor_drydock}</p>
</td>
<td style=”width: 250px; ;”>
<p style=”text-align: left;”>${result.custentity_proj_readiness_report_status}</p>
</td>
</tr>
</#list></table>
</body>
</pdf>
Please paste the exact code where the error happened
I also encountered the same error.
Exception during template merging.com.netledger.templates.TemplateServiceException: Exception during template merging.java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 16
It doesn’t seem to point to a specific line of code.