The following error can occur with PDFs served by Apache httpd, a server-side solution is given at the bottom of this post.
On trying to open a PDF file with the Acrobat Reader plugin (acroread) under both Windows and Linux, with Microsoft Internet Explorer (MS IE) and Firefox, the following message appears:
File does not begin with '%PDF-'.
The symptom above is a very general error message from the Acrobat plugin, and here I only describe one specific problem that can produce it. It is basically caused by the brower handing acroread a file and acroread going "arrrgg I have no idea what this file is".
With all the browsers above, you could save the file to disk first, then open it with Acrobat Reader and every thing is fine, it is only when the file is streamed straight from the server gzipped and passed to the plugin that the problem occurs.
To enable gzip compression for html, xhtml etc with Apache that came with Red Hat 9, it was only necessary to use the following line (for example in /etc/httpd/conf/httpd.conf):
The default Apache configuration would not gzip certain other types of files, including PDFs. Thus not confusing acroread when it tries to display the file.
However, later Linux versions associated with Red Hat require a few extra lines with Apache to avoid gzipping PDF files, these OSs include:
Fedora Core 2 (FC2)
Red Hat Enterprise Linux 3 (RHEL3)
The additional Apache configuration lines (for example in /etc/httpd/conf/httpd.conf) required are as follows:
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
OpenAsset Image & Digital Asset Management for Architects