Question

4
Replies
429
Views
Piyush Agrawal (piyush.agrawal)
Inovar
PRPC Certified
Inovar
US
piyush.agrawal Member since 2015 8 posts
Inovar
Posted: February 25, 2017
Last activity: March 20, 2017
Posted: 25 Feb 2017 3:48 EST
Last activity: 20 Mar 2017 20:20 EDT
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, This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.