Posted: 31 May 2017 13:42 EDT Last activity: 16 Oct 2018 12:03 EDT
OOTB HTMLToPDF generates Off style PDF
We have a requirement to import case information in to a PDF file and store it in a folder location. for that I'm using the OOTB HTMLToPDF activity to convert section HTML to PDF for saving it as a PDF.
When the PDF file is generated all the fields display in a single column, the styles in the HTML are gone.
Can anyone let me know whether there is any other approach i could use or how can i get the same style as in section i have created.
***Updated by Moderator:Marissa to add SR details***
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
Thanks Arnab. This works fine with case attachment. i need to generate PDF and save to the file location. when the file save to the file location PDF styles go off. Is there a way i could save the attachment to file location without user interaction
There was no HFix for this. It was determined to be an enhancement and FDBK-19974 was created. I looked up the status for this and there seems to be no progress. We suggest that you follow up with your Pega Account Executive to drive this forward.
OOTB HTMLToPDF will always loose the stylesheet if the PDF is saved or transferred via sftp or ftp. There is no way to maintain the styelsheet value as the current skin rule is not referred anywhere while creating the PDF. This is a common problem faced so far for this requirement without any solution defined.
SFTP/ FTP transfer is just a binary transfer of the bytes of a file. There's no reason to believe these mechanisms would cause any "loss of stylesheet."
HTML-To-PDF does not have full support for the CSS styles that a web browser does, as a PDF is a printable document.
I would agree that it is common to "lose the styles," because many people end up generating a PDF using plain HTML, without any CSS or references to Pega's stylesheets. The solution is to make PDFs out of harnesses, because Harnesses include styles.
The CSS is not "getting abandoned" when you use HTML-to-PDF.
Quite often, the HTML that goes into the HTML-to-PDF mechanism lacks any CSS or references to stylesheets, because the application is piping the HTML generated for a Section rule into HTML-to-PDF.
If you were to render the entire Harness including that Section to an HTML stream, and create the PDF out of that, you would see most of the styles being supported, because the Harness defines the style sheets used when the Section is viewed.
Okay. It has been confirmed to me that 7.3.1 still has the "only using a Section" limitation. Perhaps someone with more experience with including the CSS in the stream will be able to come comment on that.