Question

Inovar
SA
Last activity: 20 Mar 2017 20:20 EDT
Need code to send attached object to user.. dont want to use OOB ViewAsPDF
I need to get the byte array for the PDF attached in a WO. I tried this but its not working.. I dont want to use ViewAsPDF as I need to get it in byte array for some other purpose.
String strAttachStream = tools.findPage("FileAttachment2").getString("pyAttachStream"); //FileAttachment2 is the attachement page.
byte[] byteArray1 = strAttachStream.getBytes(); // get the bytes
String pdfName="A.pdf";
String result=tools.sendFile(byteArray1 ,pdfName,false,null,true); //send the doc to user
I tried to decode the attachment also using String decoded_strAttachStream = com.pegarules.generated.pega_rules_default.Base64Decode(strAttachStream ); then getting the bytes. But its not working.