QPrinter: PdfFormat and transparency
-
Hi,
I'm exporting a QGraphicsView to various file formats: actually pdf and the image formats supported by QImage. My problem is that I loose my items transparency when exporting to pdf although the code is very similar.
Here is the image export code:@QImage image(size, QImage::Format_ARGB32_Premultiplied);
image.fill( view->backgroundBrush().color().rgba() );
paintOnDevice (&image, view);
image.save( fileName );
@
and here is the pdf export
@QPrinter printer (QPrinter::HighResolution);
printer.setOutputFileName( QString(fileName) );
printer.setOutputFormat( QPrinter::PdfFormat );
printer.setPaperSize( size , QPrinter::Point );
paintOnDevice (&printer, view);
@
where paintOnDevice is simply:
@QPainter painter(device);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
view->render( &painter );
painter.end();
@
and where view is a QGraphicsView pointer.I'm using Qt 4.7.0 and I get the same results on Mac OS X and Ubuntu Maverick 64bits. On windows, I'm using an older version (4.6.2) but I get the same results.
Any help would be appreciatedDominique