Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open a pdf file automatically

Status
Not open for further replies.

920506

Programmer
Jun 13, 2003
201
US

Hi all,
I have asp program created a pdf file on the fly.
After the pdf file is created, I would like to open the pdf file automatically for user instead of click the link on the page. I tried, but it's not working, any clues?(The file is there, user can open it manually)

My code is like this:
<HTML>
<HEAD>
<TITLE># Print Brochure</TITLE>
</HEAD>

<BODY>

<%
OrderID=Trim(Request.QueryString("orderID"))
PONumber=Trim(Request.QueryString("ponumber"))

FileName=CreatePrintDoc(PONumber, OrderID)

'create a link that the user can open the pdf file manually
Response.Write "<p>Your <b>PDF Print Enrollment Form " &FileName & "</b> can be download <A TARGET=""_new"" Href=""/E-Cert/SelectPrint/" & FileName & """>here</A></p>."

'try to use javascript to open the pdf file automatically
%>
<script language="JavaScript">
<!--
alert('/E-Cert/SelectPrint/<%=FileName%>');
alert('<%=FileName%>');
var newWindow = window.open('/E-Cert/SelectPrint/<%=FileName%>', '_blank');
newWindow.focus();
// -->
</script>
</BODY>

</HTML>
 
Iean,
Thank you so much for the good idea.
It works perfectly.
Betty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top