Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Generated PDF style missing while using PD4ml APIs



Generated PDF style missing while using PD4ml APIs. When HTMLToPDF activity is used then reported behavior is not seen. However, business requirement is to have different header and footer on each PDF pages.

Error Messages

Not Applicable

Steps to Reproduce

1. Use HTML stream rule having &#59; and &#37. Refer below content:

<table width="100%" cellpadding="0" cellspacing="0" border="0" > <tr> <td> <table width="100%" style='table-layout: fixed;font-family:verdana;color:#001400;font-size:16px;width:100%;'> <tr><td width="50%">&nbsp;</td><td width="50%">&nbsp;</td></tr> <tr > <th style='font-size:18px;color:#2E92D1;padding:5px;' colspan="2">

2. Pass HTML stream rule to pd4ml API using java step in activity:


HTMLStream = tools.getParamValue("Markup").trim(); ;
org.zefer.pd4ml.PD4ML pd4ml = new org.zefer.pd4ml.PD4ML();
org.zefer.pd4ml.PD4Constants PD4Constants = new org.zefer.pd4ml.PD4Constants();
java.awt.Dimension Dimension = new java.awt.Dimension(); os=new; is=new; ris=new;

pd4ml.useTTF("java:fonts", true);

byte[] byteArray=os.toByteArray();


}catch(Exception e){

throw new PRRuntimeException(e.toString());

Root Cause

The reason why it is working through HTMLtoPDF activity is because pre-processing of stream is happening which removes all these.

The Pega tags will return values after escaping HTML, so semicolon and ampersand are escaped and converted to ,; % characters.


Perform the following local-change:

Instead of using Pega tags, use java script like below.

String styleValue = tools.getParamValue("fieldLabelSyl");
String propValue = tools.getProperty("pyCaption").getStringValue();
<td style='<%=styleValue%>'><%=propValue%></td>


Replace the special characters as below:


Published March 26, 2018 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us