拡張子が ".pdf" であるファイルをダウンロードさせる方法です。Webサーバーの設定を変更できる権限があることを前提としています。
Apache の場合
.htaccess ファイルに以下の記述を追加する。htmlルートの .htaccess に追記した場合、サーバー上のすべてのPDFファイルが対象になり、特定のディレクトリに以下の内容を含んだ .htaccess を配置すれば、そのディレクトリとサブディレクトリにあるPDFファイルが対象になります。なお、httpd.confで headers_module がロードされている必要があります。
<FilesMatch \.(?i:pdf)$>
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
IIS の場合
IISの場合、Apacheとは異なり特定のフォルダにあるすべてのファイルを対象とした設定になります。このため、PDFファイルだけを含んだフォルダを作成し、そのフォルダに対して設定を行う必要があるでしょう。
対象とするフォルダに、以下の内容を含む web.config ファイルを配置します。
web.config
1<?xml version="1.0"?>
2<configuration>
3 <system.webServer>
4 <httpProtocol>
5 <customHeaders>
6 <clear />
7 <add name="Content-Disposition" value="Attachment" />
8 </customHeaders>
9 </httpProtocol>
10 <staticContent>
11 <mimeMap fileExtension=".pdf" mimeType="application/octet-stream" />
12 </staticContent>
13 </system.webServer>
14</configuration>
なお、URL Rewrite というアドオンを使うと、特定の拡張子に対しての設定を行うことができます。
以上、ご参考になれば。
参考サイト:
Set Content-Disposition header to attachment only on files in a certain directory?
Force PNG to download instead of opening in browser with IIS