Question


SoftServe, Inc.
US
Last activity: 2 Jan 2020 15:59 EST
HTML to PDF generation
If anyone has tried to do HTML to PDF generation using the Pega OOTB smart shape functionality, you know that it, uhhhhh, leaves a lot to be desired. It actually produces some pretty horrible looking PDFs. For our needs, we have very well designed and professional looking PDF's that need to be generated from HTML and then sent to a number of different external stakeholders.
We know we don't like the PD4ML solution that's under the covers in the Pega OOTB and it doesn't meet our needs.
We would like to avoid re-writing our solution using eForms and the other cons that come with that solution.
What other solutions have others used?
We are considering using wkhtmltopdf (https://wkhtmltopdf.org/) because it produces great looking PDFs in the format and with the look/feel we need. However, it is a command line based tool and does have a Java Wrapper, but under the covers its still a command line based tool. We are thinking we would need PegaCloud team to install that command-line tool on the server for us. And, well, that can get a little dicey. :) Has anyone used wkhtmltopdf in Pega?
If not, I ask again, what other solutions have others used?
***Edited by Moderator: Pallavi to update platform capability tags***
-
Likes (1)
Satoru Ochiai -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!


Pegasystems Inc.
IN
Hi,
You can refer below two links to check solutions used by other for HTML to pdf conversion in pega.
https://collaborate.pega.com/question/pdf-generation-using-htmltopdf-activity
https://community1.pega.com/community/pega-support/question/conversion-html-pdf


SoftServe, Inc.
US
Hey Chandra. Thanks for your response. I've seen and read those posts. I don't think there is a post on the community about HTMLtoPDF that I haven't read. Ha! :)
The problem isn't generating a PDF from HTML. We can do that very easily. This issue we have is that the resulting PDF from the Pega OOTB HTMLtoPDF activity is absolutely horrendous looking. :) It loses all formatting and styling and layouts that are applied in the HTML and it does not look like a nicely formatted and spaced professional document.
We are looking for a solution that doesn't require us to hand-code HTML snippets nor require us to use eForms. There are a lot of products on the market that covert HTML to PDF and retain all look/feel and styling of the HTML in the PDF.
The one we like the most is wkhtmltopdf, however it is a command line tool. It does come with a Java wrapper that we can call from a Pega Java Function, however we need the wkhtmltopdf command line utility installed on the server (Pega Cloud) for this to function properly.
My question is: Has anyone ever used wkhtmltopdf in Pega, if so, how? If not, what other easy to use and maintain solutions have others leveraged to generate great looking HTML to a great looking PDF?
-
Stefan Junge Genya Megananda


Bits in Glass
IN
If you want to do with OOTB HTML TO PDF Activity
Pega has provided one css file for pdf "pyCompactStylesForPDF" which has minimal styles ,you have to include that in your HTML stream where you are including the section in HTML Stream. Then it picks most of the styles but we need to make changes according to our requirement which you have to do by overriding the css.


SoftServe, Inc.
US
Thanks to those that responded. We ended up creating the HTML using paragraph rules and using a CSS to style them before calling the pdf activity. Worked fine. Not as we wanted, but we have PDF's that look good now.


Accenture
GB
Hi Brian,
We have a similar requirement like the one you have mentioned.i.e,Converting HTML to PDF, where in HTML contains stylesheet.
When we use the OOTB approach, the screen rendering in PDF is not good. Could you please elaborate on the approach you mentioned using the paragraph rule and styling it before calling pdf activity.
Also please do mention the Pega version.
Appreciate your help!
Thanks,
Dilip


SoftServe, Inc.
US
Hi Dilip.
Pega version is Pega Infinity 8.2.1.
For the PDF's, we created Paragraph rules that included HTML Rules that represented all the parts of our PDF's (pdf header, pdf body, pdf footer). These Paragraph and HTML rules contain all static content, dynamic content, the paragraph styling, and CSS that we needed. Then in our Generate PDF flow, we called an activity that basically concatenated all of this together in an HTML Stream. In this same activity, we then called pega's OOTB HTMLtoPDF activity passing in the parameter page that contains the HTML Steam. Once the PDF is generated, we then call Code-Pega-PDF.AttachToWork to attach it to the case.
I hope that helps.
-
Genya Megananda


Accenture
GB
Thanks a lot Brian!
PDF look has improved now.
Regards,
Dilip


Wipro
IN
Hi Brian and Dilip,
As per one of the earlier suggestion, did you try styling the PDFs using pyCompactStylesForPDF? Would this help with your requirement?


DXC Technology Services LLC
IN
Hi,
I am facing some issues with alignment (for checkbox and radio buttons, text/label is coming down for checkbox and vice versa for radio buttons ) while generating pdf, almost followed the same steps mentioned above. is there anything else i need to take care of? please share.


Pegasystems Inc.
US