Question 5 Replies 4098 Views × Close popover Amit Kumar (AmitK211) Cognizant Technology Solutions Cognizant Technology Solutions IN View Profile Send Message AmitK211 Member since 2014 25 posts Cognizant Technology Solutions Posted: January 24, 2016 Last activity: January 27, 2016 Posted: 24 Jan 2016 22:58 EST Last activity: 27 Jan 2016 7:40 EST Closed Forcing PDF Download Hi, I Generate PDF using HTML to PDF and the use public API tools.sendFile to send it to browser. tools.sendFile(byteArray,lFileName,false,null,true); When this PDF goes to browser and pdf viewer plugin is installed, PDF opens by default in viewer. Is there any way, we can force download of the PDF instead of opening in viewer. Regards, Amit Pega Customer Service User Experience Low-Code App Development × Close popover Facebook Twitter Linkedin Email Copy Link Copied! Moderation Team has archived post, learn more × Close popover 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. Posted: 5 years ago Posted: 25 Jan 2016 0:17 EST × Close popover Phani Sahukaru (sahup1) PEGA Architect - Financial Services Pegasystems Inc. IN View Profile Send Message sahup1 PEGA replied to AmitK211 Hi Amit, Good morning! could you please try a customized version of @baseclass.downloadFile configured with onClick event 'Open URL in new window' ... or refer OOTB function doAttachmentSingleClick in harness rule... which is referred in Case Management mini gadget to download attached files. Please share your observations, Thank you! psahukaru Posted: 5 years ago Posted: 25 Jan 2016 2:07 EST × Close popover Amit Kumar (AmitK211) Cognizant Technology Solutions Cognizant Technology Solutions IN View Profile Send Message AmitK211 Cognizant Technology Solutions replied to sahup1 Hi Phani Sahukaru @baseclass.downloadFile uses pega_rules_default.downloadFile function which expects a filepath as parameter. But I have bytearray with me, output of HTMLtoPDF Activity. Posted: 5 years ago Posted: 25 Jan 2016 2:22 EST × Close popover Habeeb Baig (HabeebBaig) PEGA Technical Solutions Engineer Pegasystems Inc. IN View Profile Send Message HabeebBaig PEGA replied to AmitK211 Hi Amit, You can use 'always ask' option on your browser which will prompt a window asking you to open/save document. Thanks, Habeeb Baig Posted: 5 years ago Posted: 25 Jan 2016 8:13 EST × Close popover John Pritchard-Williams (JOHNPW_GCS) PEGA Client Support Team Lead Pegasystems Inc. GB View Profile Send Message JOHNPW_GCS PEGA replied to AmitK211 Hi Amit, I believe this is more likely due to your browser settings than the HTTP Headers on the PRPC side.....but it *might* be you have to ensure the 'content-dispostion' header is set to 'attachment'. Can you try using the OOTB Activity 'Code-Pega-PDF.VIEW' (which I think will set this 'content-disposition' header automatically) instead of using the Java Step 'sendFile' directly.... Thanks ! John Posted: 5 years ago Posted: 27 Jan 2016 7:40 EST × Close popover ARULDEVAN T.T (Devan) Virtusa Virtusa IN View Profile Send Message Devan Virtusa replied to AmitK211 Hi Amit, Could you please use the function sendFile(String, String, boolean, String, String, boolean, StringMap, boolean). I have used this and the PDF got downloaded instead of opening in a window. Thanks.