|
-
Apr 29th, 2006, 02:46 AM
#1
Thread Starter
Frenzied Member
PDF Download link
Hi,
I want to create a simple link (pdf image and text) from which the user can simply download a pdf document.
I store the whole link html string in a resource file, as it depends on what language the user are using.
Seems that if you say a href ='mydoc.pdf', then the document are opened in the same page, just a bunch of garbage....
I want the dialog to come up...normal way
-
Apr 30th, 2006, 03:09 PM
#2
Fanatic Member
Re: PDF Download link
what happens if you use href='file:\\path\mydoc.pdf' ?

In the unlikely event that I answer your question correctly, please Rate my post
Using Visual Studio 2005 Professional 
-
Apr 30th, 2006, 10:13 PM
#3
Thread Starter
Frenzied Member
Re: PDF Download link
Code:
<a href='file:\\CASM_sample_en.pdf'>test</a>
say page cannot be found.
Code:
<a href='CASM_sample_en.pdf'>test</a>
open the file in the same window, but not pdf, just garbage (I assume IE read into the file)
-
Apr 30th, 2006, 10:24 PM
#4
Hyperactive Member
Re: PDF Download link
I think your browser just isnt set up right, try downloading a pdf from another site.
-
Apr 30th, 2006, 10:39 PM
#5
Thread Starter
Frenzied Member
Re: PDF Download link
Thanks for the advice.
However, I have to make sure anyone, using any browser, will be able to download this documents (sample issues, subscribtion forms, etc) from my website.
I did got across some code the other day, but did not look into it...will look into it later, as I got myself caught up in some stored procedures right now.
thanks again!
-
Apr 30th, 2006, 11:41 PM
#6
Re: PDF Download link
If you upload the pdf file to a location on your site you will reference it just like any other page. If they have Acrobat then it will open in the browser. If they dont then it will present the save to dialog so they can download the file.
For ex: http://www.vbforums/downloads/myfile.pdf
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2006, 01:12 AM
#7
Thread Starter
Frenzied Member
Re: PDF Download link
that's what I thought too...believe me, it dont
-
May 1st, 2006, 04:03 AM
#8
Re: PDF Download link
Hmm, I havent linked to a pdf in a while but thats how I have always done it with Acrobat 5 and 6.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2006, 04:23 AM
#9
Re: PDF Download link
BTW, it's file:///, not file:\\.
-
May 1st, 2006, 04:29 AM
#10
Thread Starter
Frenzied Member
Re: PDF Download link
yeah...me too long ago when i played around with html, before going to good ol vb6.
apparantly one have to do something like this. I will post the solution once I got to that (got busy with some other stuff...how's that for holiday?)
Code:
Private Sub Page_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.ContentType = "application\octet-stream"
Dim filename as string=new string("c:\\downloads\\hi.doc")
Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open)
Response.Write(downloadFile.Length() & "#")
downloadFile.Close()
Response.WriteFile(filename)
Response.Flush()
Response.End()
End Sub
-
May 1st, 2006, 12:14 PM
#11
Re: PDF Download link
Yes that is the right way, except that the content type is usually "application\pdf"
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
May 1st, 2006, 06:42 PM
#12
Re: PDF Download link
application/pdf will open it in the browserwindow. application/octet-stream should trigget a download.
-
May 5th, 2006, 02:34 AM
#13
Thread Starter
Frenzied Member
Re: PDF Download link
uuuurgh..no luck
Code:
//Set the appropriate ContentType.
Response.ContentType = "application/octet-stream ";
//Get the physical path to the file.
string FilePath = MapPath("../downloads/CAND_Subscribe_en.pdf");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();
Response.Flush();
Response.End();
-
May 5th, 2006, 04:02 AM
#14
Re: PDF Download link
Try the following link:
File Upload/Download
Hope this helps!
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|