Question

2
Replies
255
Views
GopalakrishnaM0540 Member since 2018 1 post
Infosys Ltd
Posted: 2 years ago
Last activity: 2 years ago
Closed

Need to auto download the file without the options Open and Save file

Hi, I am able to download the file but my requirement is to download the file with out asking any option 'Open' or 'Save' file should auto download.

Below code is working for auto download but when user try to save the same, File name showing some thread name(having issue only in IE).

Expected: TextFile.pdf

Currently:!@3e7785c9ca4843f7ca63cc5f3e9ed8c7!OpenPortal

com.pega.pegarules.pub.util.Base64Util base = new com.pega.pegarules.pub.util.Base64Util();
String LTRFileName = tools.getParamValue("FileName");
String EDGSContent = tools.getParamValue("EDGSBinaryContent");

LTRFileName = LTRFileName+".pdf";

HashStringMap aMap = new HashStringMap();
aMap.put( "ContentDisposition", "inline; filename="+LTRFileName+";");

byte[] printData = base.decode(EDGSContent.getBytes());
String sErrorMessage1 = tools.sendFile(printData, LTRFileName, false,aMap, false);

Please suggest me to acheive my requirement.

Thanks,

Gopal

Already referred these posts:

Unable to open/download the PDF file by clicking the button again and again

How to show a PDF stream after generating it (no case to attach)?

Case Management User Interface
Moderation Team has archived post
Share this page LinkedIn