The first image printed to PDF is invisible
-
Do you have a small example project that shows this issue for us to play with?
This does sound very much like a bug to me, so maybe you should file it "here":http://bugreports.qt.nokia.com/. A small example project attached to the report will help a lot to fix the issue as the developers will take way less time to reproduce the issue.
Thanks!
-
Tobias, I think that it also can be a problem in code. Not ever heard about problems on printing to pdf, so let's wait for code sample.
-
I have no problem with Pdf
Simple example
@
QTextEdit document;
document.append("test page");
QPrinter printerPdf(QPrinter::HighResolution);
printerPdf.setPageMargins(20,10,20,20,QPrinter::Millimeter);
printerPdf.setOutputFileName("test.pdf");
document.print(&printerPdf);
@ -
stuk, post author said about problems printing images on pdf. Are you print text or images?
-
Yes, sorry i post mistake example...something like this..
@
QPixmap pix(":/img/test.jpg");
QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("test.pdf");
QPainter painter;
painter.begin(&printer);
painter.drawPixmap(0,0,100,100,pix);
painter.end();
@ -
I've found that the problem appears when I set the brush to Qt::transparent before painting the pixmap.
@
QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("output.pdf");
QPainter painter;
painter.begin(&printer);
painter.setBrush(Qt::transparent);
painter.drawPixmap(0, 0, 100, 100, QPixmap("sample.png"));
painter.drawPixmap(200, 0, 100, 100, QPixmap("sample.png"));
painter.drawPixmap(0, 100, 100, 100, QPixmap("sample2.png"));
painter.drawPixmap(200, 100, 100, 100, QPixmap("sample2.png"));
painter.end();
@
Only the second sample.png and the second sample2.png will be visible. -
Feoran, please post link to bug here.
-