I’m trying to generate a document using the sections used in a workflow. It has many number of fields that mapping them individually is not a feasible option.
Because of this Create PDF shape was not able to be used, and instead I tried using HTMLtoPDF activity and Pega component “Document Content Engine” (which also generates the doc through HTMLtoPDF).
The issue is although I could apply most of the styles with a CSS file and with the use of Pega out of the box copmpactstylesforPDF, I could not find a way to apply styles for text fields. They are always returning with around 30% of the page size.
The only option that worked for me is to define the style in paragraph rule itself which contains the sections that needs to be in the PDF. Since this is not an optimal way, has someone come across this situation and was able to get a solution for this?
What I tried to do was to apply styles to text fields, therefore I used below CSS:
input[type=“text”]{
width=200px; etc etc.
}
When I use this in a CSS file and call it as a link href it is not getting picked up. But when I added that into the paragraph rule itself, it’s picking up the style correctly.
Please create a wrapper section in HTML mode to accomodate the CSS styling and refer the respective CSS class to the fields where you want to implement the style in the inner sections that is/are referring the wrapper HTML section.
@IshanT70 Please create a wrapper section, go to html tab, and uncheck “Auto-generated HTML”. Then define the styles in the wrapper section and include the main section currently you are referring to. Please refer to the below code snippet for your reference,
I was already referring to an external CSS file for styles, but none of them were picking up from CSS unless I refer to them in the paragraph itself.
The issue was that HTMLToPDF accepts isClearCache as a parameter. By default it’s set to false. If I set it to true it clears cache and loads css each time, otherwise it refers to the cache and does not refer to the updated CSS.
I’m setting it temporarily to true until the development is complete and then later remove it once the changes are finalized.