how to open pdf files in browser
-
hi i have written code in php to open a pdf file in browser echo "pdf"; its not open pdf only start download file and after that i can open that file but i want to show this file on my browser while there is no iframe or other content please help me to show not download direct when i try to down load than download. please suggest code for me
-
hi i have written code in php to open a pdf file in browser echo "pdf"; its not open pdf only start download file and after that i can open that file but i want to show this file on my browser while there is no iframe or other content please help me to show not download direct when i try to down load than download. please suggest code for me
Google is your friend. Search for 'content-disposition header'. That's what tells the browser how to treat the pdf (or at least suggests). There is a php function to write the header.
-
hi i have written code in php to open a pdf file in browser echo "pdf"; its not open pdf only start download file and after that i can open that file but i want to show this file on my browser while there is no iframe or other content please help me to show not download direct when i try to down load than download. please suggest code for me
Following code will be helpful to open pdf file. <?php // when form submitted, redirect to PDF file if($file=="dick.pdf" || $file=="andrea.pdf" || $file=="lewis.pdf") { header("Location: $file"); exit(); } // and else just display the thing ?> <html> <head> <title>Download a PDF file</title> </head> <body> <form action="thisfile.php" method="get"> <fieldset> <legend>Please select a PDF file to download</legend> <select name="file" size="1"> <option value="dick.pdf">Dick</option> <option value="andrea.pdf">Andrea</option> <option value="lewis.pdf">Lewis</option> </select> <input type="submit" value="Download!"> </form> </body> </html> Hope this will help!
Jinal Desai
-
Following code will be helpful to open pdf file. <?php // when form submitted, redirect to PDF file if($file=="dick.pdf" || $file=="andrea.pdf" || $file=="lewis.pdf") { header("Location: $file"); exit(); } // and else just display the thing ?> <html> <head> <title>Download a PDF file</title> </head> <body> <form action="thisfile.php" method="get"> <fieldset> <legend>Please select a PDF file to download</legend> <select name="file" size="1"> <option value="dick.pdf">Dick</option> <option value="andrea.pdf">Andrea</option> <option value="lewis.pdf">Lewis</option> </select> <input type="submit" value="Download!"> </form> </body> </html> Hope this will help!
Jinal Desai
I don't know if it was you who 1-voted my reply, but I was at least answering the question the OP asked. He showed that he can write php to serve the pdf file. What he wants to do is to get the browser to display the file rather than offer a download. The way to do this is through the content-disposition header as I indicated.
-
I don't know if it was you who 1-voted my reply, but I was at least answering the question the OP asked. He showed that he can write php to serve the pdf file. What he wants to do is to get the browser to display the file rather than offer a download. The way to do this is through the content-disposition header as I indicated.
-
hi i have written code in php to open a pdf file in browser echo "pdf"; its not open pdf only start download file and after that i can open that file but i want to show this file on my browser while there is no iframe or other content please help me to show not download direct when i try to down load than download. please suggest code for me
PDF required adobe or post script plugin, close your browser and install adobe reader or some plugin that have pdf support for your browser., The second choice better you write book renderer like google books, this require ajax to load images that you created before , OR you can hunt library that can display pdf on the fly... REGARD!!!!