how to take pdf in php code example
Example 1: open pdf file in browser php
<?php
// Store the file name into variable
$file = 'filename';
$filepath = "https://www.example.com/".$file;
// Header content type
header("Content-type: application/pdf");
// Send the file to the browser.
readfile($filepath);
Example 2: php pdf
<?php
// We'll be outputting a PDF
header('Content-Type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
?>