I am generating PDFs with TCPDF, I want to save the generated pdf as blob in a MySQL db. What data should I save to the db? Code for PDF page
Output($name='example_001.pdf', $dest='I')
the values of the $dest string (Destination where to send the document) can be:
I: send the file inline to the browser (default).
D: send to the browser and force a file download with the name given by name.
F: save to a local server file with the name given by name.
S: return the document as a string (name is ignored).
FI: equivalent to F + I option
FD: equivalent to F + D option
E: return the document as base64 mime multi-part email attachment (RFC 2045)
hope that helps!
The answer is right there, in your code:
// Close and output PDF document
// **This method has several options**, check the source code documentation for more information.
$pdf->Output('example_001.pdf', 'I');
From the documentation:
Parameters: (...) string $dest Destination where to send the document. It can take one of the following values: (...) S: return the document as a string. name is ignored.
So, change your code thus:
$pdffilecontent = $pdf->Output('', 'S');
and save that string to the database