31 August 2012

How to Create a Download PDF Link


Instructions
Educate the Reader


  1. Open your HTML file for editing.
  2. Locate the tag   and navigate to the location on the page following the   tag where you want to display the PDF link.
  3. Type the following:
text  

 Click to open or right-click and select "Save As" to download.

Substitute the name of your PDF for "file.pdf" and your desired link text for "text." This HTML code assumes the PDF file is in the same web server directory as the HTML file. Otherwise, substitute for "file.pdf" the full URL "http://www.your-domain.com/foldername/file.pdf" using your own domain and folder name.

This option educates readers and allows them to make the decision about whether or not to download and save the PDF.

Changing the File Extension
  1. Compress the PDF file. Most operating systems have a built-in capability to compress files. For Windows, right-click on the file, choose "Send To," "Compressed Folder." Using the Mac operating system, Control-click on the file, and select "Create Archive."
  2. Upload the compressed archive file to your host server in the same directory as your HTML file.
  3. Open your HTML file for editing. In the "" area, type"
text

  substituting for "file.zip" your file name and for "text" your desired text label. Browsers do not automatically    open zipped files but instead direct the reader to save them.

Add a Command to the .htaccess File
  1. Locate or create the .htaccess file in your web folder on your host's web server.
  2. Open the file using a text editor.
  3.  Type the line:

             AddType application/octet-stream .pdf

             Save the changes and overwrite the previous .htaccess file.

  4.     Edit your HTML file and type in the  section:

text

Substitute for "file.pdf" your file name and for "text" your desired text label. This HTML code assumes the PDF file is uploaded to the same directory as the HTML file. Otherwise, substitute for "file.pdf" the full URL "http://www.your-domain.com/foldername/file.pdf." using your own domain and folder name.

With this method clicking the link will always open the browser's download dialog window rather than opening the file for viewing in the browser.

Sponsored Links

Tips & Warnings
Back up your HTML file before editing.

The .htaccess method is not supported by Microsoft-based web servers.

No comments:

Top 9 Simple Things Every Computer User Should Know How to Do

10.     We all know we should back up our computers, but it’s always one of those things that you’ll set up “one day”.  Setting up a ba...