Question5Replies3921Views AmitK211 Member since 2014 25 posts Cognizant Technology Solutions Posted: 4 years agoLast activity: 4 years 8 months ago Closed Forcing PDF DownloadHi,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 Interface Low-Code App Development ×Close popoverFacebookTwitterLinkedinEmail Copy Link Copied! 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. Posted: 4 years agosahup1 PEGA replied to AmitK211Hi 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: 4 years agoAmitK211 Cognizant Technology Solutions replied to sahup1Hi 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: 4 years agoHabeebBaig PEGA replied to AmitK211Hi 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: 4 years agoJOHNPW_GCS PEGA replied to AmitK211Hi 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: 4 years agoDevan Virtusa replied to AmitK211Hi 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.