Unable to export to PDF (fix)

Unable to export to PDF (fix)

Issue Description

When exporting a crystal report in cableBuilder, you may get an error:

It may also appear in the logs as:

image-20240402-120149.png

This can be caused by one of four issues:

  1. The fonts used in the report not being included in the JDK.

  2. A Windows update, specifically KB3102429, which reverts the fonts back to an out-dated version

  3. Design Alternatives are not enabled, and the exporter expects a design alt value.

  4. Tomcat service does not have the ability to open fonts

 

Fix #1: Fonts used in the report not included in the JDK

To fix this, follow these steps:

  1. Create a fonts folder -> %JAVA_HOME%/lib/fonts

  2. Copy fonts from 'C:\\Windows\Fonts' into %JAVA_HOME%/lib/fonts.

I think the problem is that newer JDK versions are not shipped with a lib/fonts folder which the Crystal Report engine expects.

 

Fix #2: A windows update reverting the fonts to an out-dated version

See the following image:

In my case, following fix #1 resolved the issue.

 

Fix #3: Design Alternatives are not enabled, and the exporter expects a design alt value

image-20241212-151745.png
image-20241212-151817.png

The fix is to edit the crystalReportExporter.jsp file and update the code where it tries getting designAlternative, and change it to version. Restart the tomcat service and try again, it should now work.

This is only required if “Enable Design Alternatives” is disabled in System Parameters in Base Data

image-20250604-115530.png

crystalReportExporter.jsp is located in the Crystal Reports home install directory

Example, before, note the arrow referencing the “designAlternative” variable on line 48 and associated parameter names:

image-20250529-085826.png

After, the above example has been replaced with “version” for all design alternative references:

image-20250529-085951.png

Fix #4: Elevate Tomcat log on user to have better priviledges

Sometimes Tomcat may not have suitable base priviledges to interact with some folders or files on the system.

Change the type from “Local Service Account”(Default) to “Local System Account” and tick the “Allow service to interact with desktop”.

This will allow the system to interact with files as a user.

image-20250604-115835.png