Results 1 to 3 of 3

Thread: printing widget(s) to postscript or PDF using vector graphics and not pixmap backing

  1. #1
    Join Date
    Jul 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default printing widget(s) to postscript or PDF using vector graphics and not pixmap backing

    Trying for the first time to print a custom widget of mine I created a QPrinter set to do postscript or PDF output and called the top widget's render() method. This did draw to the output file but as a pixmap (so not scalable). Reading the Qt code I see code suggesting this behavior may be an option and there may be a way to pass the QPrinter PaintDevice directly to my widget's paint routines so when I call things like mypainter->drawLine it results in a scalable vector rather pixels.

    So I'm wondering if others have done such saving of real scalable vector graphics from custom widgets and what settings they may have needed to make this work

    thanks for any help!

    John

  2. #2
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: printing widget(s) to postscript or PDF using vector graphics and not pixmap back

    I have used the QSVGGenerator before to create vector graphics and it worked really nicely.

  3. #3
    Join Date
    Jul 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: printing widget(s) to postscript or PDF using vector graphics and not pixmap back

    It looks easy to output one widget to QSVGGenerator but what about a multiple widgets contained in a window? I was hoping I could just set a painter to something like postscript or SVG (not as ideal since not as many document applications support this) and have Qt draw the compound widget using that painter. Instead (by default at least) the render method of QWidget (which handles compound widgets) seems to paint to a pixmap then copy that to the document as an imbedded pixel oriented image (so not scalable cleanly).

Similar Threads

  1. Replies: 1
    Last Post: 24th January 2011, 13:57
  2. Painting vector graphics...
    By Muffin in forum Newbie
    Replies: 2
    Last Post: 5th November 2009, 08:54
  3. Graphics View and the Pixmap
    By spawn9997 in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2009, 22:12
  4. Printing a pixmap full page: strange behavior on Windows
    By Pieter from Belgium in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2008, 12:29
  5. big vector graphics
    By Colx007 in forum Qt Programming
    Replies: 5
    Last Post: 22nd January 2008, 13:36

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.