# HTML To PDF conversion takes long time when a custom section used

**URL:** <https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707>\
**Category:** General\
**Tags:** dx-api, 8-6-6, case-management\
**Created:** [January 2, 2024, 11:44am UTC](https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707 "2024-01-02T11:44:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KrishnakanthT3527](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@KrishnakanthT3527](https://forums.pega.com/u/KrishnakanthT3527)\
**Post date:** [January 2, 2024, 11:44am UTC](https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707/1 "2024-01-02T11:44:39Z")

</div>

Hello All - We have a functionality to generate a PDF document and attach to the case. We use the OOTB rule **pxCreatePDF** in the process. The PDF generation was implemented for multiple screens with custom section rules. One of the section was configured to show the list of case attachments (which uses a Data Page to display the file names). The PDF generation is not happening on time when the screen with the attachments list is displayed where as the pdf generation for other screens works good.

On analysis, we could see PEGA using an open API to convert the stream to pdf in HTMLToPDF activity which takes longer duration than expected for PDF generation.

This happens sporadic in production. Not replicable in Dev or in Testing environments.

Have anyone faced this issue, if yes, could you please share how to solve this.

Log content:

at com.pega.pegarules.integration.engine.internal.util.PDFUtilsImpl.invokePD4ML(PDFUtilsImpl.java:240)  
at com.pega.pegarules.integration.engine.internal.util.PDFUtilsImpl.generatePDF(PDFUtilsImpl.java:171)  
at com.pega.pegarules.integration.engine.internal.util.PDFUtilsImpl.generatePDF(PDFUtilsImpl.java:193)  
at com.pegarules.generated.activity.ra\_action\_htmltopdf\_6f21429218308b1870939b586f71bf9d.step9\_circum0(ra\_action\_htmltopdf\_6f21429218308b1870939b586f71bf9d.java:736)  
at com.pegarules.generated.activity.ra\_action\_htmltopdf\_6f21429218308b1870939b586f71bf9d.perform(ra\_action\_htmltopdf\_6f21429218308b1870939b586f71bf9d.java:213)  
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:2855)  
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:11470)  
at com.pegarules.generated.activity.ra\_action\_pyattachaspdf\_a7743fd2c51eca1a1cbb3e940ddc5d93.step6\_circum0(ra\_action\_pyattachaspdf\_a7743fd2c51eca1a1cbb3e940ddc5d93.java:524)  
at com.pegarules.generated.activity.ra\_action\_pyattachaspdf\_a7743fd2c51eca1a1cbb3e940ddc5d93.perform(ra\_action\_pyattachaspdf\_a7743fd2c51eca1a1cbb3e940ddc5d93.java:162)

---

<div class="post-metadata">

**Author:** ![VinayK17200532](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@VinayK17200532](https://forums.pega.com/u/VinayK17200532)\
**Post date:** [January 2, 2024, 8:50pm UTC](https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707/2 "2024-01-02T20:50:33Z")

</div>

@KrishnakanthT3527 It is not idea to use heavy customization for generating pdfs, customizations are supported to some extent , u can extend css etc., If there are heavy customizations need to use third party tools , in the form of a service.

---

<div class="post-metadata">

**Author:** ![DhanasekarC0202](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/dhanasekarc0202/32/4961_2.png) [@DhanasekarC0202](https://forums.pega.com/u/DhanasekarC0202)\
**Post date:** [January 3, 2024, 6:29am UTC](https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707/3 "2024-01-03T06:29:25Z")

</div>

Hi @KrishnakanthT3527,

We also faced same issue, we handled by moving this pdf generation to spin off flow, to happen the generation parallel approach.

Thanks.

---

<div class="post-metadata">

**Author:** ![KrishnakanthT3527](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@KrishnakanthT3527](https://forums.pega.com/u/KrishnakanthT3527)\
**Post date:** [April 9, 2024, 6:36am UTC](https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707/4 "2024-04-09T06:36:17Z")

</div>

We have not used any customized UI elements part from the Section rule and Table configuration within the section. We tried to refer couple of articles and reached out to PEGA as well. As we didn’t any satisfactory answers, we have moved the PDF generation to asynchronous process by adding a new sub-flow with wait shape and SLA. This solved the issue by not impacting the users.

---

<div class="post-metadata">

**Author:** ![KrishnakanthT3527](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@KrishnakanthT3527](https://forums.pega.com/u/KrishnakanthT3527)\
**Post date:** [April 9, 2024, 6:36am UTC](https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707/5 "2024-04-09T06:36:45Z")

</div>

@vinay kumar karumanchi We have not used any customized UI elements part from the Section rule and Table configuration within the section.

---

<div class="post-metadata">

**Author:** ![KrishnakanthT3527](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@KrishnakanthT3527](https://forums.pega.com/u/KrishnakanthT3527)\
**Post date:** [April 9, 2024, 6:37am UTC](https://forums.pega.com/t/html-to-pdf-conversion-takes-long-time-when-a-custom-section-used/5707/6 "2024-04-09T06:37:42Z")

</div>

@DhanasekarC0202 Thanks, we implemented async process in the flow by ding a wait and sla.
