Skip to content

Instantly share code, notes, and snippets.

@Splint3r7
Created March 29, 2021 17:15
Show Gist options
  • Save Splint3r7/81661d9ef5e59c669bfcac650d53f707 to your computer and use it in GitHub Desktop.
Save Splint3r7/81661d9ef5e59c669bfcac650d53f707 to your computer and use it in GitHub Desktop.
Read pdf files
<?php
$file = 'test.pdf';
$filename = 'test.pdf'; /* Note: Always use .pdf at the end. */
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);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment