jiveaxe
18th January 2008, 17:03
Hi,
I have the following code for printing to pdf a widget:
void MainWindow::magToPdf()
{
if(magazineViewer) {
QPrinter printer;
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFileName(magazineViewer->windowTitle() + ".pdf");
printer.setOutputFormat(QPrinter::PdfFormat);
QPixmap qpm = QPixmap::grabWidget(magazineViewer);
if(qpm.isNull()) {
QMessageBox::critical(0, "Error", "Can not capture the window", QMessageBox::Cancel);
return;
}
QPainter p;
p.begin(&printer);
p.drawPixmap(85, 32, qpm);
p.end();
}
}
In linux it works fine: the printed page is in landscape orientation but in windows acrobat shows it in portrait, cutting the right side of the captured widget.
Is it possible to resolve this behaviour?
Thanks
I have the following code for printing to pdf a widget:
void MainWindow::magToPdf()
{
if(magazineViewer) {
QPrinter printer;
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFileName(magazineViewer->windowTitle() + ".pdf");
printer.setOutputFormat(QPrinter::PdfFormat);
QPixmap qpm = QPixmap::grabWidget(magazineViewer);
if(qpm.isNull()) {
QMessageBox::critical(0, "Error", "Can not capture the window", QMessageBox::Cancel);
return;
}
QPainter p;
p.begin(&printer);
p.drawPixmap(85, 32, qpm);
p.end();
}
}
In linux it works fine: the printed page is in landscape orientation but in windows acrobat shows it in portrait, cutting the right side of the captured widget.
Is it possible to resolve this behaviour?
Thanks