Question
1
Replies
389
Views
Posted: April 12, 2018
Last activity: May 2, 2018
Closed
Solved
To Consume the "PDFDocument" parameter
I need to use HTMLToPDF activity to create PDF file from HTML where I am referencing a section. HTMLToPDF activity has a parameter called "PDFDocument" to send the file to the user's browser. What parameter does it consume to send the PDF file to browser?
This is the code from HTMLToPDF step 4 in 7.3.1. The generatePDF function is used to generate the byteArray and that it what is put into the PDFDocument parameter. The Code-Pega-PDF.View activity can be used to view the pdf in the browser.
//Get the PDF generation utility class
PDFUtils pdfUtil=tools.getPDFUtils();
//BUG- 32651 Back-Ported HFix-2932
//Get the PDF bytes.
byte[] byteArray = pdfUtil.generatePDF(HTMLStream,tools.getParameterPage());
if (byteArray == null || byteArray.length == 0)
{
oLog.error("PDFUtils did not return any content for HTMLtoPDF");
}
else
{
//Put the byte array in a parameter
tools.putParamValue("PDFDocument",byteArray);
}