Hello,
I am using the DrawToWeb method to stream a dynamically-generated PDF to the client's browser. The default behavior (for IE at least), it seems, is to open the PDF directly inside the browser window. Is there a way to instead have the user get prompted for SAVE/OPEN, or at least have that PDF get opened in a separate browser window or browser tab?
Thanks,
Charlie
PDF streamed to browser
Re: PDF streamed to browser
Support · Dec 31, 2010Hello Charlie,
You can use overloaded DrawToWeb method which takes String and forceDownload Boolean values as parameter where the string is the file name and forceDownload is Boolean parameters to pop up a dialog which contains Save, Open and Cancel option buttons on it. You will have to set the forceDownload Boolean to true to pop up a dialog before opening the PDF. Below is the code for it.
document.DrawToWeb("MyDocument.pdf", true);
You can open the PDF file in a new window without any problem. You will have to set the target attribute of the form tag to "_blank". This will open the PDF file in a new window. You will have to add this target attribute in your aspx page for the form tag. Below is form tag format which you need to add in to your aspx page.
<form id="form1" runat="server" target="_blank">
Thanks,
ceTe Software Support Team
Re: PDF streamed to browser
Forum member · Dec 31, 2010Excellent. The boolean works like a charm. Worth noting, however, that just putting the boolean in the DrawToWeb method was all that was needed to get the PDF to open inside Adobe Reader outside of the browser window. That is happening now if the user chooses OPEN in the dialog box that pops up. So the target="_blank" is not needed.
Thanks so much for the quick reply. My customer is a happy camper!