0

Hi, i could make my website downloading a pdf files but after downloading i get this error

" There was an error opening this document. the file is damaged and could not be repaired "

i think the problem is in the PDF version because this problem just occur when downloading
pdf files of version 1.4 , but nothing happened when downloading files of version 1.6 ... so how to solve this problem with php... thanks for any help...

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by chrishea
0

You haven't provided any code so the chances of anyone being able to help you are pretty slim based on your brief definition of the problem.

0

I'm sorry; this is the code :

$DOCUMENT_ROOT=$_SERVER['DOCUMENT_ROOT'];
    $dialog_book_name = str_replace(" ","",$book_name);
    $root_file = "$DOCUMENT_ROOT"."mysite2/downbooks/";
     
    $down_url = "$root_file$book_name.pdf";
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Description: File Transfer");
    header("Content-Type: application/pdf");
    header("Content-disposition: attachment; filename=$dialog_book_name.pdf");
    header("Content-Transfer-Encoding: binary");
    header('Content-Length: ' . filesize($down_url));
    readfile($down_url);
    exit;
0

Do you have a sample file created in 1.6 format. All of my PDF files seem to be created with older versions.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.