Results 1 to 2 of 2

Thread: Save PDF to BLOB

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Save PDF to BLOB

    Dear all,

    Could anyone tell me is any way to save PDF files to MySQL (BLOB), and open BLOB as PDF in Qt Widget ?

    Thank's

  2. #2
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Save PDF to BLOB

    All you have to do to save any file to a blob, is to read it into a QByteArray using QFile and then use QSqlQuery with a sql insert instruction binding that QByteArray to the blob field.

    As for displaying it in a widget, you might need to find some kindof library that can read the PDF and make a widget that can display it (such as this).

    Often, people read it back from the SQL into a QByteArray, have QFile save it to a temp file, and use QDesktopServices to make the operating system's default viewer open it.

Similar Threads

  1. How to save file with QFileDialog
    By pnikolov in forum Qt Programming
    Replies: 11
    Last Post: 1st June 2012, 10:23
  2. how to save database
    By khalid_se in forum Newbie
    Replies: 7
    Last Post: 10th July 2011, 18:47
  3. Save images to database
    By jnk5y in forum Qt Programming
    Replies: 4
    Last Post: 8th May 2006, 19:56
  4. save animate to gif
    By Dmitry in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2006, 16:35
  5. What does "Save All" actually save?
    By Mariane in forum Newbie
    Replies: 7
    Last Post: 31st January 2006, 13:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.