Generating PDF with MPDF from BLOB

Asked

Viewed 365 times

0

Well I need to generate a PDF from a BLOB field saved in the database, my idea is to upload PDF transforming it into BLOB so as not to occupy disk space and facilitate the transport of the same.

I’m doing it this way:

include("../pdf/mpdf60/mpdf.php");

$mpdf=new mPDF(); 

$mpdf->WriteHTML($registros->BLO_PDFXX_ARQUI);


$mpdf->Output();
exit;

where the $registros->BLO_PDFXX_ARQUI is the code I’m trying to do. But here comes the question, with MPDF I have condition to do this ?

My other doubt is there is some managed that would facilitate me in this case of BLOB content ?

1 answer

1


  • This generates for me from BLOB to pdf ?

  • To do this just use php to treat the BLOB and create an html with the desired content and formatting. http://php.net/manual/en/function.ibase-blob-echo.php If you are not using Firebird this is another simple way: http://stackoverflow.com/questions/20556773/php-display-image-blob-from-mysql

  • when I’m giving echo this giving internal server error

  • am searching this way here $Bloo = ibase_blob_echo($records->BLO_PDFX_ARQUI); echo $Bloo;

  • php error log gave this PHP error Fatal error: Call to Undefined Function ibase_blob_echo()

  • This way it is simpler, the ibase_blob_echo function is a function available from the Firebird library. echo '<img src="data:image/jpeg;Base64,'. base64_encode(** $BLOB **).'"/>';

  • But it’s not an image, actually the process is as follows, the guy uploads a file. pdf transforming it into blob and saved in database, now I want to recover this .pdf. file The problem occurs while recovering BLOB data

  • You can use the same echo code '<a href="data:TYPE;Base64,'. base64_encode(** $BLOB **). '" download > Download PDF </a> ' simply change the type of the returned file and the tag.

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.