How to address the “Unable to generate document for form .jasper" error that sometimes occurs when attempting to print a document within SRM.
There are several potential causes of this error, and determining a solution will likely require a deeper analysis of the document that is being printed. To conduct that analysis, please contact Texada Support by phone at 1-800-361-1233 Ext 1, or by email at email@example.com.
- The "Unable to generate document for form .jasper" error is sometimes encountered when attempting to print a document, such as a Contract or Work Order, from Texada SRM.
- This error is usually caused by invalid characters being present in the document’s contents. This can often occur when copying and pasting content from another source.
- To resolve this error:
- Enable XML debugging in SRM by navigating to System Maintenance → Configure System Settings → System → Company Parameters → Customer Forms → Debug Off, then selecting “Generate XML Only” and clicking “OK”.
- Reprint the problem document from SRM to receive an .rtf file containing the document’s raw XML.
- Open the .rtf file in a text editor such as Microsoft Word and read through it for suspicious characters, such as □, ☒, �, or Ã§.
- Open the problem document in SRM and delete and re-type any fields containing invalid characters. If this content was originally copied and pasted from another source, try entering the text manually instead.
- Once you are confident that all of the invalid characters have been removed, switch off XML debugging from the same menu and reprint your document again. Ensure that the error is resolved and that the PDF’s contents are displayed correctly.
Appearance and Cause
The primary cause of this issue is invalid character(s) being present in a document comment or line item description. This will often result in a error similar to this:
The primary indicator of this issue is the following line:
"Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:"
This is most often caused when data is copied from one location (such as an Excel spreadsheet or a Vendor's online marketplace) and pasted into a Texada SRM data field. The majority of the time this is not an issue, but if the source document is using an older or otherwise unsupported character set, it can cause this issue to occur. Texada Software does not explicitly recommend against the copy and paste of data, but directly typing in the information will guarantee this does not occur.
To resolve this error, the characters causing document generation to fail must be identified and removed. The best way to accomplish this is by enabling XML debugging in SRM. This will allow you to see documents as the system sees them, and identify problem characters.
- Log in to SRM and navigate to the Customer Forms Configuration window (GLCN90Q) at System Maintenance → Configure System Settings → System → Company Parameters → Customer Forms.
- Click the “Debug” button on the right side of this window. Depending on your current debug settings, this button may be labeled “Debug Off”, “Debug PDF”, or “Debug XML”.
- In the pop-up window, select “Generate XML Only”, then click “OK”. This will enable XML debugging for your current session only: debugging will be switched off automatically the next time you log off and log back in to SRM.
- While XML debugging is switched on, any document you generate in SRM will not generate in PDF format as usual. Instead, you will receive a rich text (.rtf) file containing the raw XML that the system uses to generate its PDFs. These .rtf files can be opened in any text editor and will resemble the following:
- With XML debugging enabled, reprint the document that originally caused the error. Open the .rtf file you receive in a text editor such as Microsoft Word, and examine it for any suspicious characters. These are characters that aren’t displaying correctly or that do not belong, and will often be one of the following:
- A white square: □
- A white rectangle with an ‘x’ through it: ☒
- A black diamond with a white question mark inside it: �
- Random characters which do not match those entered: Ã§
- Once you have identified the problem characters, open the document in SRM, then delete and re-enter the contents of the affected fields. If this content was originally copied and pasted from another source, try entering the text manually instead.
- After replacing the invalid characters and saving your changes, reprint the document to confirm that the issue is resolved.
- Once you are confident that all the problem characters have been removed, switch off XML debugging by navigating to System Maintenance → Configure System Settings → System → Company Parameters → Customer Forms → Debug XML, then selecting “Turn Debugging Off” and clicking “OK”.
- Reprint your document again in PDF format. Ensure that the error does not occur and that the document’s contents are displayed correctly.