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…
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
$binaryvariable. 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: