Click to See Complete Forum and Search --> : Downloadable PDF Link...
DesignIt
12-16-2005, 09:53 PM
How do you make a downloadable PDF link? :D
PersonasBinar
12-16-2005, 11:24 PM
Pls explain
DesignIt
12-16-2005, 11:35 PM
Pls explain
I have a link on my site where I want people to be able to download a printable PDF file.
PersonasBinar
12-17-2005, 12:12 AM
on the site it's a save to: ref? of ppl can right click and save target as......
though clicking might get it opened in a browser window...i think it's a save as reference you're looking for in the HTML.
Neuro
12-17-2005, 03:55 AM
I have had to do a ZIP file for a downloadable PDF portfolio I wanted possible clients to get to. I found it easier for them to download and unzip it rather than deal with the pdf reader opening it in there browsers. If you make it a zip and use that link, I think it should automaticly start by asking you to save it (download) it somewhere.
SurfPark
12-17-2005, 07:33 AM
Agree with you on the zip file. For most people, the idea of "downloading," yet, having the PDF simentaneously open in their browser is confusing. We are used to downloading and having to double click an icon to excute it. In addtion, having them open the PDF via a zip file won't make their computer go nuts by auto-starting the Acrobat Reader.
Please, whatever you do, lable the PDF download! Websites that simply say:
"Click here to download this document"
Are far too vauge. Instead try labeling it like this:
"Download this PDF Document (.zip format, 3 MB)"
People will know what tools they need to view it and be able to estimate the download time.
DesignIt
12-19-2005, 02:29 PM
Agree with you on the zip file. For most people, the idea of "downloading," yet, having the PDF simentaneously open in their browser is confusing. We are used to downloading and having to double click an icon to excute it. In addtion, having them open the PDF via a zip file won't make their computer go nuts by auto-starting the Acrobat Reader.
Please, whatever you do, lable the PDF download! Websites that simply say:
"Click here to download this document"
Are far too vauge. Instead try labeling it like this:
"Download this PDF Document (.zip format, 3 MB)"
People will know what tools they need to view it and be able to estimate the download time.
YES!
This is exactly what I want to do. How should the code for the link look for the PDF?
THANKS!! :D
DesignIt
12-19-2005, 02:57 PM
I got it figured out. =)
The pdf's are quite small (less than 100kb for each), so I don't think a zip will be necessary.
Ryan8720
12-19-2005, 08:02 PM
You can do it with PHP. But your server will have to support PHP and the file will have to have a .php extension.
Add this to the top of the page:
<?php
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="fileName.pdf"');
?>
PersonasBinar
12-19-2005, 08:09 PM
As long as the browser doesn't try to open the PDF oooooh I hate it when that happens.
JPnyc
12-19-2005, 08:16 PM
Yeah I hate that too. In fact I had the whole file format. Not to mention that after Adopey acrobat opens to read the file, once you close it you have to open task manager and close the acro32.dll that eats up over 30mb of system resource.
Roo-1
12-19-2005, 08:36 PM
Normally just a link will launch the Acrobat plugin right in the browser.
Recently though I had a client that wanted a message box tp pop up...this is achieved with a bit of asp, (not something I know much about since I hate MS languages)
This will give a box that gives the option of saving the file to the hard drive or opening it with Acrobat Reader.
*IF* you have asp enabled on the hosting server:
Open a plain text editor and paste this in changing the name of the .pdf file to your file name. (I have bolded it)
Give this file the same name as your pdf with an asp extention.
yourpdfname.asp (do not put .pdf here...if you .pdf is named brochure.pdf, then this would be brochire.asp)
Upload this file is ASCII format with your FTP program.
<%@Language="VBScript"%>
<%Option Explicit%>
<%Response.Buffer = True%>
<%
On Error Resume Next
Dim strPath
strPath = "nameofyourfile.pdf"
Call DownloadFile(strPath)
Private Sub DownloadFile(file)
'--declare variables
Dim strAbsFile
Dim strFileExtension
Dim objFSO
Dim objFile
Dim objStream
'-- set absolute file location
strAbsFile = Server.MapPath(file)
'-- create FSO object to check if file exists and get properties
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'-- check to see if the file exists
If objFSO.FileExists(strAbsFile) Then
Set objFile = objFSO.GetFile(strAbsFile)
'-- first clear the response, and then set the appropriate headers
Response.Clear
'-- the filename you give it will be the one that is shown
' to the users by default when they save
Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/pdf"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
'-- set as binary
objStream.Type = 1
Response.CharSet = "UTF-8"
'-- load into the stream the file
objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
Else 'objFSO.FileExists(strAbsFile)
Response.Clear
Response.Write("No such file exists.")
End If
Set objFSO = Nothing
End Sub
%>
Make sure this file is in the same directory as the pdf..
Oops..correction... the link is not normal it's:
<a href="filename.asp">Link Text</a>
Ryan8720
12-19-2005, 08:41 PM
Yeah I hate that too. In fact I had the whole file format. Not to mention that after Adopey acrobat opens to read the file, once you close it you have to open task manager and close the acro32.dll that eats up over 30mb of system resource.
Install Acrobat Reader SpeedUp (http://www.tnk-bootblock.co.uk/prods/misc/index.php). It disables a bunch of the not commonly used plugins. It really makes a noticeable difference with load time.
JPnyc
12-19-2005, 08:54 PM
Load time isn't the issue, it's that the main dll of the program doesn't close when you close the program. It stays open eating memory. Anyway I never visited a site with PDF format twice.
Roo-1
12-19-2005, 08:56 PM
I KNOW...talk about ANNOYING!!
ecsyle
12-19-2005, 09:51 PM
Well, just do this (PHP)
<?php
$file=(isset($_GET['file']))?$_GET['file']:false;
if(isset($file)){
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$file.'.pdf"');
}
?>
Save it as download.php, then call "download.php?file=filename" in your link. Might be a wise idea to add some methods to check to make sure the file exists, is a pdf, etc. But it works.
Ryan8720
12-19-2005, 10:32 PM
*cough* I posted that already. *cough*
ecsyle
12-19-2005, 10:42 PM
Right, but it seemed to me that the OP needed a bit more info :/
Like how to call the file...
Also, the one i posted would allow him to just have one "download" file instead of creating a new page for each PDF.
Ryan8720
12-20-2005, 12:21 AM
Fair enough.
DesignIt
12-20-2005, 02:27 PM
Yeah I hate that too. In fact I had the whole file format. Not to mention that after Adopey acrobat opens to read the file, once you close it you have to open task manager and close the acro32.dll that eats up over 30mb of system resource.
Is this on a pc or a mac? Because on a mac I have no problems with Acrobat eating up memory. =)
Also, thanks everyone, for your responses. Greatly appreciated!! =)
JPnyc
12-20-2005, 02:54 PM
I've used a mac maybe 3x in my life, so I dunno if you can check running processes but on windows format the dll is acro32.dll, or something close to that. I have the memory to spare but I hate programs using resource when they're not needed. And it ALWAYS remains open after the reader is closed. Can't stand programs that do that. RealPlayer and Quicktime are 2 others that do it. I won't have em on my PC.
PersonasBinar
12-20-2005, 03:12 PM
Long Live Resident in Memory!!!!!!!
DesignIt
12-20-2005, 04:10 PM
I've used a mac maybe 3x in my life, so I dunno if you can check running processes but on windows format the dll is acro32.dll, or something close to that. I have the memory to spare but I hate programs using resource when they're not needed. And it ALWAYS remains open after the reader is closed. Can't stand programs that do that. RealPlayer and Quicktime are 2 others that do it. I won't have em on my PC.
I guess this isn't a big deal for me as my mac runs great with about 10 programs open. hee hee
But I see your point. =)
JPnyc
12-20-2005, 04:47 PM
I have a gig of memory on a p4@3.4ghz, but it's the principle. I can run a slew of things with no lag but what adopey does is akin to stealing, in my view. It's using memory it has no right to.