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

Margin in generated PDF is incorrect after upgrade to Pega 7.1.7



Upgraded to Pega 7.1.7 with CPM 7.1.3 from Pega 6.1 SP1 and CPM 6.1 SP1. 
The OOTB code allowed the setting of fixed margins in Pega 6.1 SP1. Unable to set using the OOTB in Pega 7. There is a marked difference in the PDF output generated in Pega 6 and Pega 7.

Error Messages

Not Applicable

Steps to Reproduce

The OOTB code of HTMLToPDF is unable to set the margin size and hence there is a skew in the margins that is clearly displayed in the generated PDF.

Root Cause

The root cause of this problem is that the setting the body margin values seems to be different when it comes to PDF generation using PD4ML. 


The explanation for this behavior is as follows:

The body margin values and representation in an HTML page depends on page size, border and document. This behavior seems to be different when it comes to PDF generation using PD4ML.

As per the PD4ML specifications, controlling the body margin attributes, during PDF generation, is dependent on pageInsets (margins) and htmlWidth methods (also known as userSpaceWidth in some contexts).

These attributes are not exposed to set while using OOTB activity and the default values are being considered as per the below code PD4ML code in Pega7. 

.setPageInsets(new Insets(20, 10, 10, 10));

Therefore, even on setting the margin at body level, it is not applied after PDF Generation. But setting the CSS styles on other elements like div, table, paragraph, li tags work fine. 
Suggest Edit

Published August 13, 2015 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

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

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