Return to Snippet

Revision: 22545
at January 15, 2010 00:17 by cburyta


Initial Code
// pdfString is the *contents* of a file.
// to serve a file that exists on the file system, use readfile() instead of print $pdfString

header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Length: ' . strlen($pdfString));
header('Content-Disposition: attachment; filename=' . 'pdf_dynamic.pdf');
ob_clean();
flush();
print $pdfString;
exit;

Initial URL


Initial Description
Quick basic way to serve a string or a file through PHP

Initial Title
Serve PDF file with PHP

Initial Tags
header, file

Initial Language
PHP