Skip to main content
LinkedIn
Copied!

Table of Contents

Troubleshooting HTML-to-PDF Conversion issues

Line breaks missing

Border styles not displayed, cells empty

Report Definition export to PDF after upgrade from Pega 7.2.2 to Pega 7.4

Refresh Section designed for downloading PDF misbehaves

Font size difference using SmartShape

Required fonts not applied in generated PDF

Styling issue with check box and Inline dynamic layout

HTMLtoPDF activity run by an agent styles missing 

Large number of table rows not exported to PDF after upgrade

Table formatting issues with inline styling

Section grid layout not reading CSS from Skin

Help topic update for Pega 8.1 through Pega 8.3

Split table when exporting to PDF in Report Definition

Pega-supported HTMLtoPDF parameters for Pega 8.2 and earlier releases

Line breaks missing

Symptom

After using the activity HTMLtoPDF to generate PDF, you notice that the line breaks added in the RTE are not reflected in the PDF output.

Explanation

Custom styling in the CSS is defective.

Solution: Local change

See SA-68597, PDF generated using HTMLtoPDF activity does not have line break

Remove the following custom styling in the CSS file:

p {

     margin: 0px;

}

Border styles not displayed, cells empty

Symptom

After using the activity pyViewAsPdf to generate PDF output, you notice in the PDF output that the border styles are not displayed and table cells display no content; they are empty.

Explanation

Customer markup is defective.

Solution: Local change

  1. Apply Compact styling before calling the HTMLtoPDF activity:

On the Parameters page of the rule form, set the string property UseCompactStylesforPDF to true.

Alternatively, set the Parameter using the following code before calling the HTMLtoPDF activity:

Tools.putParamValue

(“UseCompactStylesforPDF”,

”true”);

  1. Avoid HTML input processing before calling the HTMLtoPDF activity:

On the Parameters page of the rule form, set the property pyHTMLDisableProcessing to true.

Alternatively, set the Parameter using the following code before calling the HTMLtoPDF activity:

Tools.putParamValue

(“pyHTMLDisableProcessing”,

”true”);

See also SA-69112 PDF table borders do not display. (HFix-45601 applies to Pega 7.3.1.)

Report Definition export to PDF borders incorrect after upgrade from Pega 7.2.2 to Pega 7.4

Symptom

After upgrading their systems from Pega 7.2.2 to Pega 7.4, users report that when using the Report Definition action Export to PDF, they observe that cell borders are not correctly displayed.

Explanation

The border styles are collapsed. Hence, some borders align incorrectly.

table {
  border-collapse: collapse;
}

Solution: Local change

See SA-76324, Cells in generated PDF align incorrectly

Refresh Section designed for downloading PDF misbehaves

Symptom

Using Pega 7.4, you are using Export to PDF on a dynamic layout designed with an onClick action to allow application users to click Refresh Section and invoke the HTMLtoPDF activity by sending the required parameters to generate the PDF file. After the Refresh Section action is triggered and during the reloading of the harness, some parameter pages are removed, and the HTML stream is null. This functionality worked as expected in Pega 7.1.7 applications.

Explanation

Refresh Section cannot be used for downloading PDF or other files.

Solution: Local change

The Refresh Section activity cannot be configured for downloading PDF files generated from HTML. Instead, you should use the Run Script activity for a control. Run Script passes the function name that needs to be run. The function takes two parameters: Activity Name and Class Name. The Activity Name is a custom activity for which you set some parameters in the parameters page before calling the HTMLtoPDF activity.

Follow this example:

  1. Add an action Run Script with Function Name downloadFile and specify the following parameter Names and Values:
    • activityName customPDFActivity
    • class @baseclass
       
      "Custom PDF activity Run Script Download File"
      Custom PDF activity Run Script Download File
  2. Attach a script tag containing the function specified in the User Work form.
    Here is an example of the script:

<script>

function downloadFile(activityName, className){ 
var suURL = SafeURL_createFromURL(pega.u.d.url); 
suURL.put("pyActivity", activityName); 
suURL.put("pyClassName", className); 
var formEle = document.createElement('form'); 
formEle.id = "download_file"; 
formEle.method = "POST"; 
formEle.action = suURL.toURL(); 
if(pega.env.ua.webkit) 
formEle.target = ""; 
document.body.appendChild(formEle); 
formEle.submit(); 
document.body.removeChild(formEle); 

</script>

See also SA-71354, Export to PDF does not download PDF.

Font size difference using SmartShape

Symptom

Font size differs in PDF using SmartShape and pxCreatePDF.

A PDF file is generated in two ways: through the SmartShape in the flow and using pxcreatePDF in the HTMLtoPDF activity. The generated PDF files display different font sizes. The PDF files should have the same font size, regardless of how they were generated.

Explanation

The application skin is applied when the PDF is generated through a flow SmartShape; the font size is controlled by the skin.

Solution: Local change

For Pega 7.4 and later releases, you can use the Dynamic System setting (DSS) called UseCompactStylesForPDF. When you set this DSS to true, the application skin is not imported into the PDF.

This true setting calls the rule pyCompactStylesForPDF.css, which provides a bare minimum CSS with some default styles that you can use to override the CSS used by the application skin. All PDFs will have a consistent CSS applied.

As an alternative to setting the DSS, you can specify Compact Styles by passing a parameter UseCompactStylesForPDF to the HTMLtoPDF activity with value true.

Be sure to set the parameter before calling the activity HTMLtoPDF using one of the following choices:

  • Set the parameter to true on the Parameters page of the activity, or
  • Use the following line of code:

Tools.putParamValue

(“UseCompactStylesforPDF”,

”true”);

Required fonts not applied in generated PDF

Symptom

Required fonts are not applied in the generated PDF. Specifically, a section with a grid containing Chinese characters is created with Calibri font specified as the Inline style for labels and fields. The generated PDF displays the Times New Roman font instead of Calibri.

Explanation

A software use or operator error: The fonts in the Windows directory were missing in the Pega application server directory.

Solution: Local change

Create a non-auto section and place the CSS needed in the non-auto section in the <style> tag. Then include the non-auto section above all in the section that you want to export to PDF.

Follow these steps:

  1. Download Times New Roman font (or any required font style).
  2. Add the font in the Fonts directory.
  3. Create a non-auto section.
  4. Add the required CSS in the non-auto section between the <style> tags.
  5. Include the non-auto section above all in the section that must be exported to PDF.

<style>

     body{

     font-family: <FONT_NAME>;

    }

</style>

  1. Copy the FONT_NAME from the pd4fonts.properties file.

Styling issue with check box and Inline dynamic layout

Symptom

When PDF is generated through the createPDF SmartShape, the styling for Inline dynamic layout check box and its label are not displayed correctly.

Explanation

An internal issue with the PD4ML library causes some styles not to be rendered correctly. In this case, the style display: inline-block is displayed incorrectly.

Solution: Local change

In this case, the user does not want to use the DSS setting UseCompactStylesForPDF because the application skin will not be generated.

Instead of using a check box and a label with inline styling, use the checkbox caption to achieve the same effect.

HTMLtoPDF activity run by an agent styles missing

Symptom

When you create a PDF using the HTMLtoPDF activity, if the activity is run by an agent, the styles are not included in the generated PDF.  The styles are included if the activity is executed manually. 

Explanation

A software use or operator error: Styles are lost when the HTMLtoPDF activity is run by an agent.

Solution: Local change

Specify the Access Group in the Security tab of the Agent rule to ensure that the style markup matches the style markup when the HTMLtoPDF activity is run standalone, without an agent.

See SA-79488, Styles are not included in generated PDF.

Large number of table rows not exported to PDF after upgrade

Symptom

Export to PDF does not work whenever the number of rows to be exported is 1000 or more. Before upgrading from PRPC 6.3 to Pega 7.4, users noticed that PDF generation was fast, taking 10 minutes or less. On Pega 7.4, PDF generation takes longer or fails with large numbers of rows.

Explanation

Pega 7.4 introduced many changes in terms of execution, whereby new infrastructure components and internal APIs consume more resources and take more time, unavoidably. Because the grid markup is work object oriented, the extra processing is required.

Solution

Apply the new property Split table when exporting to PDF as described in Help topic update for Pega 8.1 through Pega 8.3Split table when exporting to PDF in Report Definition.

Table formatting issues with inline styling

Symptom

While using the HTMLtoPDF activity, users notice a spacing issue between table headers in generated PDF. Borders for the headers and data cells are added through inline styling.

Explanation

Inline styles are used in the section along with custom configurations for the table.

Solution: Local change

  1. Set the DSS setting UseCompactStylesforPDF to true.
  2. Set the property in the Parameters tab of the HTMLtoPDF activity.
  3. Make the relevant CSS changes in the file pyCompactStylesforPDF.css.

See also Font size difference using SmartShape.

Section grid layout not reading CSS from Skin

Symptom

The Section grid does not pick the Cascading Style Sheet (CSS) from skin while generating a PDF using the HTMLtoPDF activity. The PDF does not display CSS for grid columns, rows, font family, and font size.

Explanation

An old version of the PD4ML library was in use.

Solution: Local change

Download and install the latest PD4ML version, 3.10.0 PRPC.1.

See SA-78787, Section grid does not pick CSS from skin

Help topic update for Pega 8.1 through Pega 8.3

Split table when exporting to PDF in Report Definition

In the Help topic for Pega 8.3 and earlier releases to Pega 8.1, Report Definition Data Access tab, the  property, Split table when exporting to PDF, was omitted. This new property was added in Pega 7.3 HFix-51852, Pega 7.4 HFix-52879, and delivered in Pega 8.1, as shown in the following image for Reporting database > Prefer reporting data source if defined > Split table when exporting to PDF.

"Reporting database, Prefer data source, Split table when exporting to PDF"
Reporting database, Prefer data source, Split table when exporting to PDF

In the Help topic for Pega 8.3 and earlier releases to Pega 8.1, Report Definition Data Access tab, under General Data Source Settings, and below Ignore application skin when exporting to PDF, the following information should appear for the new property, Field and Description:

Report Definition, Data Access, Split table when exporting to PDF

Field

Description

Split table when exporting to PDF in Report Definition

Splits the records into small tables for faster generation of PDF.

Set to true when there are many records for a table.

When set to true, two additional properties are displayed:

  • Number of rows in each split table
    Gives the user a handle to customize the number of rows needed in each split table
  • Insert page break after each table split
    Ensures that each split table comes in a separate page

For large records, generation of PDF from HTML through PD4ML takes more time; this property is a workaround for optimizing the time taken to generate PDF from given markup.

 

Pega-supported HTMLtoPDF parameters for Pega 8.2 and earlier releases

The following table lists the parameters in the Pega-provided HTMLtoPDF activity and their purpose. These parameters are available for Pega Platform 8.2 and earlier releases. For parameters supported in Pega 8.3 and later releases, see the appropriate Help topic or article, for example, PDF files rendering scenarios or Generating PDFs and attaching them to work objects or viewing them in web browsers.

The Number column has no significance. It is provided for easy reference only.
Pega HTMLtoPDF parameters for Pega 8.2 and earlier releases

Number

Parameter

Purpose

Default Value

Is PD4ML
Specific?

 

1

pyPDFPageOrientation

Sets the page orientation of the PDF document: Landscape or Portrait

Landscape

Yes

 

2

pyPDFPageSize

Sets the page size of the PDF document

A4

Yes

 

3

pyPDFEnableHyperlinks

Enables hyperlinks in the PDF document when set to true. When set to false, hyperlinks are not actionable.

false

Yes

 

4

pyPDFFontsDirectory

Specifies the path to the directory where fonts are located

Empty

Yes

 

5

pyPDFEmbedFont

Enables the fonts to be embedded into the PDF document from pyPDFFontsDirectory when set to true

false

Yes

 

6

pyPDFPropsDirectory

Specifies the directory to use at run time to generate the Properties file during PDF generation (optional)

Empty

Yes

 

7

pyPDFHeaderHTMLTemplate

Defines the HTML code to be rendered in page headers

Example: <div style="color:blue;"> page $[ page] of total $[total] </div>

Empty

Yes

 

8

pyPDFFooterHTMLTemplate

Defines the HTML code to be rendered in page footers

Example: <div style="color:blue;"> page $[ page] of total $[total] </div>

Empty

Yes

 

9

pyGenerateToolTips

Produces tooltips from TITLE HTML attributes (PDF Annotations) when set to true

false

Yes

10

pyEnableSmartTableBreaks

Enables PD4ML insertion of page breaks in between table rows to make the table portions fit page height when set to true

If the table has a header, a true setting replicates the header row in each table section

false

Yes

11

isClearCache

Removes all objects (images, CSS) from internal PD4ML caches when set to true

A true setting helps to avoid memory leaks with huge TTF and TTC files after PDF generation.

false

Yes

12

pyHTMLDisableProcessing

Disables processing the HTML input for conformance when set to true

Pega pre-processes the HTML stream and invokes the HTML TIDY utility to get a clean stream of the HTML input.

false

No

13

startPage

Sets the page number counter to the specified value for page numbering in document headers and footers

1

Yes

14

pyEnableOutlines

Generates outlines or bookmarks in the PDF document when set to true

Outlines can be generated from anchor tags, <a name="Bookmark1">.

false

Yes

15

pyPDFGeneratePDFA

Forces PD4ML to output PDF compliant with the PDF/A specification for long-term archiving

Method call does not guarantee the generated output to be of format PDF/A if fonts embedding is not set to true.

 

Request the last rendering status to check if the generated PDF document is PDF/A compliant.

false

Yes

16

pyShowWarning

Shows the log warning during HTML TIDY parsing when set to true (optional)

HTML TIDY errors are always shown.

false

No

17

pyEditablePDF

 Makes the PDF editable when set to true, forcing PD4ML to convert HTML forms into PDF forms (Acroforms)

When set to true, InputTextBox, check box, and other form elements become editable.

false

Yes

 

 

 

Did you find this content helpful?

100% found this useful


Related Content

Have a question? Get answers now.

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

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

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