Question

4
Replies
379
Views
piyush.agrawal Member since 2015 8 posts
Inovar
Posted: February 25, 2017
Last activity: March 20, 2017
Closed
Solved

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.

Data Integration Java and Activities
Moderation Team has archived post
Share this page LinkedIn