Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2005, 11:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default Openning a PDF file

Hi All,

I am trying to open up a "PDF" file in a new window
and the following code does not work.

"<%@language="vbscript"%>
<% option explicit %>

<% dim strPDFfile

    strPDFfile = "D:\TEST.PDF"

%>

<html>
<body>
        <a href="#" onClick=window.open(<%=strPDFfile%>,"Pdf_form","he ight=450px,width=700px")><br />
            PDF FORM</a>
</body>
</html>
"

Thanks,
:)


MCinar

Love all the creatures because of the creator.
__________________
MCinar

Love all the creatures because of the creator.
 
Old February 11th, 2005, 01:25 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

You cannot access files that are outside the virtual directory using a link. Otherwise, it will be very easy for hackers to locate files of other sites on their web host.

You need to put PDF file in a directory within the physical path of your virtual directory. Or access it through its http address. Please see the modified code below.

--------------------------------------------------------------------------------
<%@language="vbscript"%>
<% option explicit %>

<% dim strPDFfile

    strPDFfile = "www.yoursite.com/pdf/test.pdf"

%>

<html>
<body>
        <br /><a href="#" onclick="window.open('http://<%=strPDFfile%>','Pdf_form','height=450px,width=70 0px');">PDF FORM</a>
</body>
</html>
-------------------------------------------------------------------------------

Please see some of the double quotes were replaced by me with single quote (to avoid JS errors).
 
Old February 11th, 2005, 01:30 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

<%@language="vbscript"%>
<% option explicit %>

<% dim strPDFfile
    strPDFfile = "Oct04.pdf"
%>

<html>
<body>
  <a href="#" onClick=window.open('<%=strPDFfile%>',"Pdf_form"," height=450px,width=700px")>PDF FORM</a>
</body>
</html>


Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old February 11th, 2005, 01:32 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

basically if your file was in the same path in which your asp files are placed ... then the only mistake which you have done is ... you have missed the single quotes around <%=strPDFfile%> ...

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old February 11th, 2005, 11:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you, Vadivel.
It was very helpful.



MCinar

Love all the creatures because of the creator.
 
Old February 11th, 2005, 11:49 PM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Glad that I could be of some help to others :)

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
convert HTML File to PDF file in vb.net gaurikhot .NET Framework 2.0 4 June 16th, 2014 02:33 AM
How to display .tif file, .pdf file and .jpg file phuong171 ASP.NET 1.0 and 1.1 Basics 1 March 13th, 2007 07:29 AM
Save PDF file as text file in VB.Net kvenkatu Classic ASP Basics 0 April 7th, 2006 01:09 PM
save a PDF file as text file through VB. NET kvenkatu VB.NET 0 April 6th, 2006 12:15 PM
problem openning huge xls file helmekki Excel VBA 3 October 5th, 2004 04:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.