Opening PDF in new window

Opening PDF in new window

Forum member · May 14, 2007
Hi, I am using your dynamic pdf generator to create a report. Currently i am using Doc.DrawToWeb(allowbrowsercaching,"DownloadAs",forceDownload); Doc.DrawToWeb(false,"temp.pdf",false); myPage.Response.end; How do i force the pdf to open in a new window? If it opens in the same window i loose my viewstate. Thanks in Advanced.

Re: Opening PDF in new window

Support · May 15, 2007
Hello, You can open the PDF in a new window by setting the target attribute of the form tag to _blank. You can refer to the SelectPages example which opens the PDF in a new window. Thanks, ceTe Software Support Team.

Re: Opening PDF in new window

Forum member · May 15, 2007
Hi, The problem is that i have multiple links, buttons and other controls such as menu inside the form. I only want the pdf to be generated in new window and rest of the links to open in the same window.

Re: Opening PDF in new window

Support · May 15, 2007
Hello, Since you have number of buttons, you will need to do is have a onClick event on all buttons that calls a javascript function with a parameter and in that function set the document.form.taget = “_blank” for the button you wish to open the new window and reset it to “” for the other buttons. Thanks, ceTe Software Support Team.

Re: Opening PDF in new window

Forum member · May 15, 2007
Thanks for the hint, I was able to solve the problem by hooking in the following javascript on my page. <script language = "JavaScript"> if (typeof(__doPostBack) == "function") { var __doPostBackOLD = __doPostBack; __doPostBack = function(eventTarget, eventArgument) { if(eventArgument == "Print:0" || eventArgument == "PrintAll:0" || eventArgument == "Export:0" ) document.Form1.target = "_blank"; else document.Form1.target = ""; __doPostBackOLD(eventTarget, eventArgument); } } </script>