Section embedded in paragraph rule for generating PDF doesnot get same formatting of section

Below are the steps to generate a Pdf where we will embed a section as input , and to get exact UI formatting of section in PDF.

Create a HTML rule as below


<pega:include name="sectionxxxx" type="Rule-HTML-Section" />

<br />

  <pega:include name="sectionyyy" type="Rule-HTML-Section" />

<br />

  <pega:include name="sectionzzz" type="Rule-HTML-Section" />

  

</head>
this gives exact styling in pdf as in section.

Now create a activity

step -1 property set

Param.FileName=“yyyy.pdf”

step -2 call pyViewAsPDF

HTMLSTREAM=above html rule name

PDFName= Param.filename

Now call it in section on any button with on click open url in new window-give activity name

window name parameter should be as “_self” (Quotes not required).

HTML rule to include the required sections with the pega:include tag, because this keeps the same section styling in the generated PDF. Add each section in that HTML rule in the order you want them to appear. Then create an activity that first sets Param.FileName to the PDF name. In the next step, call pyViewAsPDF and pass the HTML rule name in HTMLSTREAM and the file name in PDFName. Finally, call this activity from the button using Open URL in new window and set the window name to _self. This generates the PDF with the same formatting as the original sections.