Question
Ernst & Young LLP
IN
Last activity: 25 Jan 2023 15:06 EST
Preview an Image in a New Tab On Click Of a Link Without Downloading it
Hi All,
I have a requirement of showing the content of a PDF/Image, on click of a link without downloading it.
On click of the link, we are getting the ByteStream of the PDF/Image through API call and passing the ByteStream in the below Java Code.
This is working fine for PDF but for Image ( JPEG/JPG/PNG format) is not working, it is displaying blank image in a new tab. In tracer, I do not see any error and all parameters are being passed correctly.
If anyone has faced this before, kindly help.
Thanks in advance.
JAVA Code:
-On click using open url window and calling an Activity, In that activity, using the below code in Java step:
String s = tools.getParamValue("ByteStream").toString();
byte[] byteArray=Base64Util.decodeToByteArray(s);
//ByteStreamis the base64 encoded string
String AttachmentName = tools.getParamValue("AttachmentName").toString();
tools.sendFile(byteArray, AttachmentName, false, null, false );
//AttachmentName is the name of the attachment in Pega