Results 1 to 2 of 2

Thread: Save PDF to BLOB

Hybrid View

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

    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
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    48
    Thanked 4 Times in 4 Posts

    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, 11:23
  2. how to save database
    By khalid_se in forum Newbie
    Replies: 7
    Last Post: 10th July 2011, 19:47
  3. Save images to database
    By jnk5y in forum Qt Programming
    Replies: 4
    Last Post: 8th May 2006, 20:56
  4. save animate to gif
    By Dmitry in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2006, 17:35
  5. What does "Save All" actually save?
    By Mariane in forum Newbie
    Replies: 7
    Last Post: 31st January 2006, 14: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
  •  
Qt is a trademark of The Qt Company.