[Qt-interest] QGraphicsView render to PDF not working

Sean Harmer sean.harmer at maps-technology.com
Thu Jan 20 09:43:44 CET 2011


On Thursday 20 January 2011 02:52:05 Deepak Chandran wrote:
> I have a program using QGraphicsScene. The scene has lots of object (with
> shades, curves, etc). I want to save the scene as a PDF, but it is not
> working. Exporting as a QImage and writing that image to a file works
> fine, so I am not sure exactly where the problem is. Below is a summary of
> the code. The code works if I use a QImage and render the scene onto it,
> but it does not work if I use a PDF file.
> 
> //main print code
>         QPrinter printer(QPrinter::HighResolution);

Try using QPrinter::ScreenResolution instead. There is a bug in the pdf output 
that seems to be triggered by using HighResolution. This seems to be a weak 
subsystem that could really do with some serious effort.

Good luck,

Sean



More information about the Qt-interest-old mailing list