PHP Classes

Store PDF as binary in Database and read it as PDF or HTML: I want to convert PDF file in Binery

Recommend this page to a friend!
  All requests RSS feed  >  Store PDF as binary in Database and r...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Store PDF as binary in Database and read it as PDF or HTML


Picture of muabshir by muabshir - 6 years ago (2017-03-13)

I want to convert PDF file in Binery

This request is clear and relevant.
This request is not clear or is not relevant.


I want to STORE PDF in database as binary and called it as PDF or Word or HTML formate

  • 2 Clarification requests
  • 2. Picture of Dantigny francois by Dantigny francois - 11 months ago (2023-03-18) Reply

    Pay attention : if you store a PDF file as a BLOB, you must retrieve this BLOB as PDF file ! If you store an HTML file (or a Word file) you can save it as TEXT (and retrieve it as TEXT).

    • 1. Picture of Dave Smith by Dave Smith - 6 years ago (2017-04-30) Reply

      pdf is already binary. You can use file_get_contents() to read the file into a variable and then save that in the database as a BLOB (binary large object).

      To display it in the browser, you just need to send the appropriate content headers before you echo the data.

      Ask clarification

      1 Recommendation

      Handle Binary Files With PDO: Save and load binary files in databases using PDO

      This recommendation solves the problem.
      This recommendation does not solve the problem.


      Picture of zinsou A.A.E.Mo´se by zinsou A.A.E.Mo´se package author package author Reputation 5840 - 6 years ago (2017-12-21) Comment

      you can try this...

      Recommend package