How do I generate a pdf-file from a binary file retrieved from database in php5? It comes base64 encoded, and I just decoded it, but don't know what to do next...
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
The binary data is simply the actual file, or rather the important contents of that file, just without file name.
And there you have the file data/contents of the file in the
$binary
variable. From here, it depends on what you want to do. You can write the data to a file, and you get an "actual" PDF file:You can spit the data out to the browser with an appropriate header, and the user will receive something that looks like a PDF file to him:
I'm repeating your last sentence .:) I dont know what is the question! :). If you want to pus the file to a browser, you can set the headers and stream the decoded content. Or if you want the file as is, write on to file system and use it. Please be more clear on your question!
Thanks!!