Error Messages in Advanced Templates

There are two conditions under which error messages can be displayed when working with advanced templates. You may see an error related to the virtual record generated when saving a template. You may also see error messages when you preview, save or print a template.

Virtual Record when Saving Template

When a template is saved, the printing engine generates a virtual record to make sure that the template can be printed. If your template uses a substring function, a temporary string may be used that does not contain enough characters to let the function to go through correctly. If this occurs you may see an error message similar to the following.

The template cannot be saved due to the following errors: Exception during template merging. java.lang.StringIndexOutOfBoundsException: String index out of range: 9

For example, the following line in a template will work when you are printing the record but not when the template is saved because the temporary string will not be long enough:

${item.taxcode?substring(4,9)}

To ensure that the template saves correctly, add an if statement to verify the length of the string.

            <#if (item.taxcode?length > 9)> ${item.taxcode?substring(4,9)}
</#if> 

          

Errors when Previewing, Saving or Printing Templates

When you preview or save an advanced template, if the preview cannot be shown, or if the template cannot be saved, an error message appears. The message displays the line and the column where the error occurred.

Also, when a PDF document does not print and fails with an error, the error message includes the template name, line, and column where the error occurred. Click Detail… to see more information about the error encountered. Administrators can use this information to address the issue with the template.

Note:

For PDF creation, there is a size limitation of 100MB for XML file input. If the file size exceeds 100MB, printing results in an error.

Related Topics

General Notices