Discussion
Pegasystems Inc.
US
Last activity: 3 Sep 2024 9:48 EDT
Ask the Expert - Pega PD4ML PDF Generation with Priyanka Boga and Shivaji Kadiyam
Join us in August's second Ask the Expert with @Priyanka Boga, Principal Engineer, Technical Support, User and Product Experience and @shivaji kadiyam, Senior Engineer, Technical Support - User and Product Experience answer your questions about Pega PD4ML PDF Generation with Pega.
Make sure to Favorite and Follow for updates via the Notification bell and/or weekly digest!
Session dates: 19 August - 30 August
Session opens to questions on 19 August!
Meet Your Experts:
Hi, I am Priyanka Boga, I've been in various customer facing roles over the years in Pega and helping clients to do the right thing at the right time. At the same time, I enjoyed thoroughly assessing the problem reported by clients to enhance the product wherever possible. It's a true delight for me to offer support to our clients in various platform versions starting PRPC 6 to recent Infinity 24. Over the years, I've explored lot of Pega platform features, the one which is close to my heart is "PDF Generation" in the platform and I'm excited to be in this forum to share the knowledge with you all.
Greetings! I am Shivaji Kadiyam, I've been working with Pega clients and partners for the last 3 years. I have spent most of my time in the User Interface of the platform where I made sure UI Rendering, UI embedding, UI Generation of the platform works as designed. I've thoroughly enjoyed assessing multiple use cases shared by client to help client move forward as well as product to enhance. I'm here to share with you the information I curated over the years about PDF features in Pega. I'm excited and looking forward to a great conversation.
Message from Your Experts:
We are very excited and thrilled to interact with all our clients and partners. We are here in "Ask the expert" forum to share the information that we are curated over the years about how a PDF can be configured, generated and downloaded in Pega Platform. We request you to keep the questions coming-in, any question on PDF feature in platform is welcome :), Please do not hesitate to ask. To make this forum more interesting, We would come up with new subtopics every day in PDF throughout this session. So, keep visiting the page and follow to get updates.
Ask the Expert Rules
- Follow the Pega Support Center's Rules of Engagement
- This is not a Live Chat - Priyanka and Shivaji will reply to your questions over the course of the session
- Questions should be clearly and succinctly expressed
- Questions should be of interest to many others in the audience
- Have fun!
-
Likes (1)
Kashif Minhaj P K -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Updated: 19 Aug 2024 2:31 EDT
700 Applications
IN
@MarissaRogers Hello Priyanka/Shivaji. Recently we got requirement from Client for PDF document generation, i have experience in this area and worked in 8.3 version. But now in my current project we are using 8.7.3, to achieve handsome look and feel of generated PDF previously PEGA allowed us to create custom header, footer, body through HTML rules and passing those to pxCreatePDF/HTMLtoPDF activity. But now in 8.7.3 HTML rule was depreciated, so we thought to use PEGA OOTB PDF smart shape for this, the resulting PDF which was created was not at all looking impressive for it's look and feel. Can you suggest how we can achieve generating PDF with greater look/styles just by passing section rule in 8.7.3. Thanks in Advance :)
-
Kashif Minhaj P K Priyanka Boga Shivaji Kadiyam
Updated: 19 Aug 2024 6:05 EDT
Pegasystems Inc.
IN
Hi @DineshBhargav.V -
Thank you for asking the question.
Using the custom activity as well we can pass the section rules. Instead of using Property-Set-HTML need to use Property-Set-Stream step.
Pass property as param.pyPDFHeaderHTMLTemplate , StreamClass as Rule-HTML-Section and StreamName pass the section name.
Thank you.
-
Shivaji Kadiyam Kashif Minhaj P K
700 Apps
SA
Hi Priyanka Boga/Shivaji Kadiyam, I truly appreciate the initiation of this discussion. I believe it will be beneficial for multiple clients across the globe. Our client has been using PDF document generation for years. However, there has been an issue from day one where some PDFs are generated with "??" marks in place of Arabic characters, causing significant problems in production. To give you an idea, approximately 3,000 documents are generated daily, and around 10-20 of these PDFs contain "??" marks. We have tried multiple approaches to address this issue:
Hi Priyanka Boga/Shivaji Kadiyam, I truly appreciate the initiation of this discussion. I believe it will be beneficial for multiple clients across the globe. Our client has been using PDF document generation for years. However, there has been an issue from day one where some PDFs are generated with "??" marks in place of Arabic characters, causing significant problems in production. To give you an idea, approximately 3,000 documents are generated daily, and around 10-20 of these PDFs contain "??" marks. We have tried multiple approaches to address this issue:
- Since the PDFs are generated through paragraph rules with custom styling, we identified that two font families were missing in both Pega and the server path. After uploading the .ttf files to Pega, the occurrence of "??" marks reduced to 3-4 per day. However, some PDFs are now generated with an unfamiliar font style.
- We execute a job during non-business hours to scan all generated documents and identify those containing "??" marks, and regenerate them. This helps address the issue within a 1-day SLA. Notably, regenerated documents do not exhibit the "??" marks.
Despite these measures, we seek to understand the root cause and find a permanent fix. The challenge is that this issue is not observed in lower environments but only in production during peak business hours when the document creation rate is high. Any insights or suggestions on resolving this issue would be greatly appreciated. Thank you!
-
Dinesh Bhargav Priyanka Boga Shivaji Kadiyam
Updated: 19 Aug 2024 6:38 EDT
Pegasystems Inc.
IN
Thank you for the appreciation.
As per our understanding, the Arabic font files are being uploaded. Please confirm whether the font files are uploaded to the server path or through the binary files?
Pega recommends using binary files for the fonts support during the PDF generation. When accessing the font files through the server path will lead to high maintenance, and we will also get inconsistent results . Upgrades won't be smooth in using the server font files. Please follow a detailed document to implement the binary files for the fonts .
-
Priyanka Boga Kashif Minhaj P K
Pegasystems Inc.
IN
Hello Developers,
As part of today's topic , I am attaching the detailed document of how we can generate PDF in Pega and also added different ways to generate the PDF.
Thank you.
-
Dinesh Bhargav Shivaji Kadiyam Marissa Rogers
Intel Corporation
IN
@MarissaRogers Hi Priyanka/Shivaji. Thank you for initiating the discussion about PDF generation, I just wanted to know if we can also convert a docx which is based on a HTML/OOXML to pdf without losing the format/styling with the help of PD4ML or any library available ootb in PEGA. Any suggestions on this would be really helpful. Thanks in advance.!
-
Priyanka Boga
Pegasystems Inc.
IN
Hi @ajithkumar.p ,
Thank you for asking the question.
Using PD4ML we cannot use docx or any particular template to get the PDF. It only rely on html content send to it. Other than PD4ML in Pega we have iText library which is used for Eforms generation in Pega. Please find below link for more details on Eforms.
https://docs.pega.com/bundle/platform/page/platform/reference/rules/map-eform-rules.html
In Launchpad product we have a Liberoffice library which converts word document template to PDF. This is available only in Launchpad and not in Constellation or Infinity. We have future plan for this to be implemented in Infinity.
-
AJITHKUMAR P Shivaji Kadiyam
Accenture
SG
Hi Hi Priyanka Boga/Shivaji Kadiyam,
Generating PDF using HTMLToPDF using paragraph rules. Inside Paragraph rules used Page-break which are working in version 8.7.3 but the same doesnt work in 23.1.0 where Page-Break is not working. Attached the images for reference.
-
Priyanka Boga
Pegasystems Inc.
IN
Thank you for the question.
In 8.7.3 the PD4ML jar version used is 4.0.13 and in 23.1.0 we used 4.013fx8 PD4ML version jar which has a regression issue. This jar is not executing page break css styles. We have existing hotfix for 23.1.0 version. Please spin off Support ticket to get the hotfix for this issue.
-
Shivaji Kadiyam
Pegasystems Inc.
IN
Hello Developers,
Today's topic is about the importance of HTMLToPDF activity. This activity is main and responsible for generation of PDF. The important parameters required for this activity is filename and Markup. Markup holds complete html content in string form and filename holds name of the file with extension as pdf ex - test.pdf .
Attaching the document related to it.
Thank you.
-
Shivaji Kadiyam Dinesh Bhargav
Pegasystems Inc.
IN
Hello Developers,
Today, we're sharing details about the pyPDFSettings parameters and Compact Styles.
- The HTMLtoPDF activity, which you use to generate PDFs from your application, includes several parameters for controlling the appearance and formatting of your files. These parameters can be adjusted globally for all PDFs using the pyPDFSetting (Data Transform) or customized for individual PDFs within the custom activity.
For a detailed explanation of each parameter and its usage, please refer to the link below:
https://docs.pega.com/bundle/platform/page/platform/user-experience/pdf-parameters.html
- In Pega, there is a DSS called UseCompactStylesforPDF that disables the usage of SKIN CSS when generating PDFs. Additionally, we have separate files to manage custom CSS.
Please refer to the document below for more information about Compact Styles and their usage.
Please let us know if you have any questions regarding the information provided above.
-
Priyanka Boga Marissa Rogers Dinesh Bhargav
Pegasystems Inc.
IN
Hello,
As part of today's topic sharing the detailed document related to debugging steps. This document will help you to find the root cause of any PDF generation issues.
Thank you.
-
Shivaji Kadiyam Marissa Rogers
Areteans Technology Solutions Australia
AU
Hi Priyanka and Shivaji,
We are generating PDF using html markup from pxCreatePDF activity. Our PDF has too many tables with map screenshot content. We see inconsistent behaviour during PDF generation where some of the pages are blank . We are Pega 23.1.1 version. We had raised an incident for this and suggestion was to use div tags instead of paragraph tags. It worked fine for few of the PDFs but issue is back now. Can you please suggest how we can fix this?
Thanks in advance
-
Priyanka Boga Shivaji Kadiyam
Pegasystems Inc.
IN
Hi @Acquil,
Thank you for the question.
Could you please verify whether the param.pyEnableSmartTableBreaks is set to true or not? and also verify the DSS UseSmartTableBreak is set to true. Reconfirm these parameters in tracer while generating the PDF.
Also verify in any paragraph rule where the blank page is seen , by any chance page-break-after or page-break-before styles have been added explicitly? If yes please remove and verify the issue.
-
Acquil Coelho Shivaji Kadiyam
Accenture Philippines
PH
Hi @Priyanka Boga, I am using pxCreatePDF to generate PDF inside loop and I am setting all the required parameters before I call the pxCreatePDF, The pdf was generating but the only problem is, only the last value of the iteration is used by the ootb pxCreatePDF. So the output is 2 pdf files with the same content. Can you please tell why this happening. Thanks
-
Shivaji Kadiyam Priyanka Boga
Pegasystems Inc.
IN
Thank you for the question.
Could you please share the screenshot of the activity rule and also if possible share us the tracer file to understand the root cause and possible solutions.
-
Shivaji Kadiyam
Accenture Philippines
PH
Hi Please refer to the attach png below thanks. @Priyanka Boga Note that I rename the pxCreatePDF to CreateDocumentAsPDF.
-
Priyanka Boga
Pegasystems Inc.
IN
Thank you for sharing the screen shots.
When verified the error message from tracer image, the issue is from insHandle param which has to be passed to pxCreatePDF activity. Nothing related to the duplicate content in PDF.
Could you please share the complete tracer zip file to understand what params are been passed while looping.
Accenture Philippines
PH
Hi @Priyanka Boga the params passing to pxCreatePDF is the pzinskey of the current work object. Do we need to passed other params beside from pzinskey? Thanks.
Pegasystems Inc.
IN
Yes, We need to pass SectionName and PDFName params. SectionName parameter holds the content which need to be displayed on the PDF.
Please verify the SectionName parameter in tracer why its not getting modified when looping.
Thank you.
Pegasystems Inc.
IN
Hello,
I am sharing the detailed configuration document for the following PDF features as part of today's topic:
- Header
- Footer
- Watermark
- Page Number (scope)
- Title
- Watermark
Thank you
-
Priyanka Boga
Pegasystems Inc.
IN
Hello Developers,
Today's topic is about the issues related alignment issues seen in PDF generation when using skin or custom stylesheet. I am attaching the document which holds detailed information.
Thank you.
-
Shivaji Kadiyam
Updated: 29 Aug 2024 8:48 EDT
Pegasystems Inc.
IN
Hello Developers,
Today, we'll be sharing the details about how to address performance issues and explore possible solutions.
- Generating the PDF using skin styles can lead to performance issues because PD4ML takes time to compile the large skin file, which contains over 25,000 lines. To mitigate this, set the DSS parameter “UseCompactStylesForPDF” to true.
- Additionally, setting the parameter `param.isClearCache` to true can also cause performance issues, as it clears the cache and forces the system to regenerate the PDF, caching the required files again. Use this parameter judiciously.
Large Content: When generating PDFs with a large number of pages, the process may be slow and cause performance issues. To avoid this, try to minimize the amount of content being exported to PDF and consider using other document formats like Excel or Word.
External Content: If the PDF generation process involves external content, you may experience slowness or a 504 gateway error if the resources are unavailable at the time of generation. To prevent this, follow these steps:
Hello Developers,
Today, we'll be sharing the details about how to address performance issues and explore possible solutions.
- Generating the PDF using skin styles can lead to performance issues because PD4ML takes time to compile the large skin file, which contains over 25,000 lines. To mitigate this, set the DSS parameter “UseCompactStylesForPDF” to true.
- Additionally, setting the parameter `param.isClearCache` to true can also cause performance issues, as it clears the cache and forces the system to regenerate the PDF, caching the required files again. Use this parameter judiciously.
Large Content: When generating PDFs with a large number of pages, the process may be slow and cause performance issues. To avoid this, try to minimize the amount of content being exported to PDF and consider using other document formats like Excel or Word.
External Content: If the PDF generation process involves external content, you may experience slowness or a 504 gateway error if the resources are unavailable at the time of generation. To prevent this, follow these steps:
- Open `pyPDFSettings` and set `param.timeoutForExternalContent` to 1000 or another appropriate value in milliseconds.Please check the below article for more info about the parameters https://docs.pega.com/bundle/platform/page/platform/user-experience/pdf-parameters.html
- To determine if external resources are causing performance issues, you can set specific PDF loggers in Pega. The logs will clearly indicate if there is a delay in retrieving certain files.
- com.pega.pegarules.integration.engine.internal.util.PDFUtilsImpl
- com.pega.pegarules.integration.engine.internal.mapping.PDFResourceHandler
For more information about the stable pd4ml library , please refer to the "Stable PD4ML Library" and "Known Limitations of PD4ML 4.0.9fx5 Jar" sections in the article linked below. https://support.pega.com/support-doc/pd4ml-versions-and-hotfixes
Thank you
-
Priyanka Boga Dinesh Bhargav
Pegasystems Inc.
IN
Hello Developers,
I would like to share insights related to blank pages issues seen while generating the PDF.
Scenario: After generating PDF will be seeing blank pages and when verified Markup value, will be seeing “display: none” inline style is been added for every element.
- In the activity before property-set-HTML for setting the Markup parameter need to call activity “pzSetUITemplateStatus”
- pzSetUITemplateStatus activity will disable the templatization in Pega and set the Markup. This is to overcome unknown attributes generated specific to Pega which won’t be understandable by PD4ML.
https://support.pega.com/support-doc/video-how-troublehoot-blank-pdf-issues
Scenario: Getting multiple blank pages in between of PDF pages. Could see content in starting and ending pages but multiple blank pages in between.
- The root cause of the issue either due to external attributes specific to that tool example Outlook content, some formulas, some google content etc., which won’t be understandable by PD4ML and generates numerous blank pages
0KB content or no content return by HTMLToPDF issues:
- To overcome these issues need to set param.pyHTMLDisableProcessing to true
Thank you.
-
Shivaji Kadiyam Dinesh Bhargav
Pegasystems Inc.
IN
Hello,
As part of today's topic , I am attaching the detailed document about Chart Image support in PDF. Ideally its a known limitation from Pega why because the Chart image is dynamically generated during the run time .To achieve this functionality we are having a below custom implementation.
Please find the below attachment.
Thank you.
-
Priyanka Boga Dinesh Bhargav MADDULURI VENKATA SAI KALYAN Shivaji Kadiyam
Pegasystems Inc.
IN
Hello Developers,
As part of today's topic , Will be sharing common issues faces during PDF generation in Report browser.
When exporting the report to PDF or excel if no file is downloading and seeing below error in Pega logs?
MSG][Activity pzRDExportWrapper failed to execute][STACK][com.pega.pegarules.pub.PRRuntimeException: Section 'pzRDExportWrapper' execution error on page '' of class 'Rule-Obj-Report-Definition'. : java.lang.reflect.InvocationTargetException at com.pegarules.generated.html.ra_stream_pzrdexportwrapper_8a003fbd0799660a40b7054ec93dd4aa.execute(ra_stream_pzrdexportwrapper_8a003fbd0799660a40b7054ec93dd4aa.java:121) at com.pega.pegarules.session.internal.mgmt.Executable.getStream(Executable.java:4370) at com.pega.pegarules.session.internal.mgmt.Executable.getStream(Executable.java:4191) at com.pega.pegarules.pub.runtime.AbstractActivity.showHtml(AbstractActivity.java:279) at com.pegarules.generated.activity.ra_action_pzrdexportwrapper_f3c5bdeb1c5301ca6c28c4235aeae849.step1_circum0(ra_action_pzrdexportwrapper_f3c5bdeb1c5301ca6c28c4235aeae849.java:626) at
- This issue is not related to Pega but issue is with Java JDK where the font support is missing to download any document. The fontManager of JDK has install fontconfig to support these document generations.
504 Gateway errors / Performance issues:
Hello Developers,
As part of today's topic , Will be sharing common issues faces during PDF generation in Report browser.
When exporting the report to PDF or excel if no file is downloading and seeing below error in Pega logs?
MSG][Activity pzRDExportWrapper failed to execute][STACK][com.pega.pegarules.pub.PRRuntimeException: Section 'pzRDExportWrapper' execution error on page '' of class 'Rule-Obj-Report-Definition'. : java.lang.reflect.InvocationTargetException at com.pegarules.generated.html.ra_stream_pzrdexportwrapper_8a003fbd0799660a40b7054ec93dd4aa.execute(ra_stream_pzrdexportwrapper_8a003fbd0799660a40b7054ec93dd4aa.java:121) at com.pega.pegarules.session.internal.mgmt.Executable.getStream(Executable.java:4370) at com.pega.pegarules.session.internal.mgmt.Executable.getStream(Executable.java:4191) at com.pega.pegarules.pub.runtime.AbstractActivity.showHtml(AbstractActivity.java:279) at com.pegarules.generated.activity.ra_action_pzrdexportwrapper_f3c5bdeb1c5301ca6c28c4235aeae849.step1_circum0(ra_action_pzrdexportwrapper_f3c5bdeb1c5301ca6c28c4235aeae849.java:626) at
- This issue is not related to Pega but issue is with Java JDK where the font support is missing to download any document. The fontManager of JDK has install fontconfig to support these document generations.
504 Gateway errors / Performance issues:
When generating the PDF for more records will be seeing the performance issues and sometimes the node will go down as well
- Open report definition rule and navigate to Data access tab and enable “Ignore application skin when exporting to PDF” and “Ignore formatting when exporting to PDF”
- The above settings will reduce the compile time at PD4ML side which in turn reduces the performance.
- For scenarios like huge data like thousands of records which we suggest to go ahead with excel generation which will be user friendly easy to search and access the content.
Note: Wisely choose Excel or PDF document based upon the content and business needs. PDF is only suitable for less content with cosmetic view not for huge content.
Thank you.
-
Shivaji Kadiyam Dinesh Bhargav
Pegasystems Inc.
US
Thank you to @Priyanka Boga and @shivaji kadiyam for this amazing Ask the Expert session on Pega PD4ML PDF Generation!
Thank you for sharing content to help those who are looking for resources on this topic!
This session is now closed to future questions and/or replies. If you have a question on Pega PD4ML PDF Generation, please ask a new question.
Bookmark our Ask the Expert homepage to stay up-to-date on future sessions!
-
Priyanka Boga