Display the pdf file using php

This post used to display the pdf file in webpages using php. This tip very useful to developer to display the file pdf in web pages ...

Index.html

<html>
<head>
<meta charset="utf-8">
<title>Display the pdf file using php</title>
</head>
<body>
<?php
$file = 'dummy.pdf';
$filename = 'dummy.pdf';
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
@readfile($file);
?>
<a href="http://www.sanwebcorner.com/">San web corner</a>
</body>
</html>

Post a Comment

0 Comments