Support Article

Caught exception while creating PDF from HTML stream



User configured the Create PDF smart shape in a flow but the PDF does not generate successfully.
The user has the application server on RHEL 7.4 operating system.

Error Messages

The below error appears in the log :-

@baseclassHTMLtoPDF activity, step 4 - " Caught exception while creating PDF from HTML stream".

Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at sun.font.CompositeStrike.getStrikeForSlot(
at sun.font.CompositeStrike.getFontMetrics(
at sun.font.FontDesignMetrics.initMatrixAndMetrics(
at sun.font.FontDesignMetrics.<init>(
at sun.font.FontDesignMetrics.getMetrics(
at sun.font.FontDesignMetrics.getMetrics(
at sun.awt.SunToolkit.getFontMetrics(
at sun.awt.HeadlessToolkit.getFontMetrics(
at org.zefer.font.c.super(Unknown Source)
at org.zefer.font.c.<init>(Unknown Source)
at org.zefer.cache.ResourceCache.getFontMetrics(Unknown Source)
at org.zefer.html.doc.q.Ó00000(Unknown Source)
at org.zefer.html.doc.q.Ö00000(Unknown Source)
at org.zefer.html.doc.w.<init>(Unknown Source)
at org.zefer.html.doc.PD4MLHtmlParser.buildDocument(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at com.pega.pegarules.integration.engine.internal.util.PDFUtilsImpl.invokePD4ML(
at com.pega.pegarules.integration.engine.internal.util.PDFUtilsImpl.convertHTMLToPDF(
at com.pega.pegarules.integration.engine.internal.util.PDFUtilsImpl.generatePDF(

Steps to Reproduce

1. Create a Flow.
2. Configure a Create PDF smart shape.

Root Cause

This is an issue with the RHEL OS version 7.4.

In this OS version the the default font has changed from Utopia to STIX.
The Open JDK does not go well with the STIX font and thus the PD4ML library fails during PDF generation.


Make the following change to the operating environment:

1. Create a file /etc/fonts/local.conf and include the below entries
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>

2. Save the file and restart the server and check the PDF generation from Pega.

Published February 21, 2018 - Updated October 8, 2020

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.