PHP uses a standard code to display the pdf file in web browser. The process of displaying pdf involves location of the PDF file on the server and it uses various types of headers to define content composition in form of type, Disposition, Transfer-Encoding etc. PHP passes the PDF files to read it on the browser. Browser either shows it or download it from localhost server then display pdf.
Note: PHP is not actually reading the PDF file. It does not recognize File as pdf. It only passes the PDF file to the browser to be read there. If copy the pdf file inside htdocs folder of XAMPP then it does not need to specify the file path.
Example 1: This example display the pdf file on the browser.
this examples displays a format and explains every section of code
- Difference between Web Browser and Web Server
- How to get the size of screen, current web page and browser window using jQuery?
- Web 1.0, Web 2.0 and Web 3.0 with their difference
- How to disable browser Autocomplete on web form field/input tag?
- Difference between Search Engine and Web Browser
- How to make PDF file downloadable in HTML link using PHP ?
- How to get the number of pages in a PDF document using PHP ?
- PHP | FPDF-PDF Generator
- How to convert a PDF document to a preview image in PHP?
- How to display a PDF as an image in React app using URL?
- How to detect Browser Language in PHP?
- How to give a div tag 100% height of the browser window using CSS
- How to jump to top of browser page using jQuery?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.