Discussion
Molina HealthCare
US
Last activity: 10 Dec 2021 6:09 EST
How to Get Content from PDF file placed in Shared path to stream into Pega
Hi,
We are trying with this code for Streaming into the browser. But its not working.
String filePath = tools.getParamValue("FilePath");
java.io.FileInputStream fileInputStream=null;
java.io.File file = new java.io.File(filePath);
byte[] bFile = new byte[(int) file.length()];
try {
fileInputStream = new java.io.FileInputStream(file);
fileInputStream.read(bFile);
fileInputStream.close();
}
catch(Exception e){
e.printStackTrace();
}
/* Change the name of the Test.docx to the actual file name that needs to be downloaded with extension.*/
String sErrorMessage = tools.sendFile(bFile, "Test.pdf", false, null, false);
if (sErrorMessage != null){
tools.getThread().getThreadPage().putString("pyXMLStream", sErrorMessage);
}