How To Display PDF File in PHP on Browser -

Example to show PDF file in PHP in HTML web page

<?php 
$filename = "D:\wamp\www\myprojects\image1.pdf";
// Header
content type header("Content-type: application/pdf"); header("Content-Length: " . filesize($filename));
// Send the file to the browser.
readfile($filename);
?>

--

--

--

Hi, This is Biplab and I am web developer well versed in PHP and other open source technologies. I am here to share my experience with the community.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bipsmedium

Bipsmedium

Hi, This is Biplab and I am web developer well versed in PHP and other open source technologies. I am here to share my experience with the community.

More from Medium

Best Light Themes for PhpStorm

PHP Curl Get Request with Parameters Example

Why should we use Laravel blade ?

Laravel Blade Template

My First Pull Request to Laravel Framework — Part 1