I used this code to download pdf files:
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Type: application/octetstream');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment; filename=\"".basename($filename)."\"");
readfile("$file");
}
This should be good, and make sure there are no spaces or return characters (best not to avoid php php).
If you find that you still have problems, open the damaged file using notepad (there may be a php error warning inside).
Hope this helps!