Problem opening PDF after creating it using PHP and storing in the MySQL table.
Hello,
I am creating a pdf document and outputting it as a string using:
$mypdf = $pdf->Output('', 'S');
I am then putting it into a database as a BLOB and redirecting to page y using:
$insertSQL = sprintf("INSERT INTO PDF_file (pdf_name) VALUES (%s)",
GetSQLValueString($mypdf, "text"));
mysql_select_db($database_files, $files);
$Result1 = mysql_query($insertSQL, $files) or die(mysql_error());
I have a link on page y called:
<a href="home.php?pdf_id=<?php echo $row_getPDF['pdf_id'];?>">Click here to view your PDF.</a>
When whoever clicks the link, the following is processed:
if (isset($_GET['pdf_id'])) {
header("Content-type: application/pdf");
header('Content-disposition: attachment; filename="myresume.pdf"');
echo $row_getPDF['pdf_name'];
}
A box opens and I am giving the option to open or save the file. The pdf downloads but when I try to view it there is a couple lines present on the second page and that's it. The pdf is either not being stored properly or not downloaded properly. It works just fine when I am not converting it into a string. Any help is appreciated.
Thanks,
Kelsey
