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...

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.

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;

hello, is there any help to solve this problem.....

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.