Hi,
I have the following code for printing to pdf a widget:
void MainWindow::magToPdf()
{
if(magazineViewer) {
printer.
setOrientation(QPrinter::Landscape);
printer.setOutputFileName(magazineViewer->windowTitle() + ".pdf");
printer.
setOutputFormat(QPrinter::PdfFormat);
if(qpm.isNull()) {
return;
}
p.begin(&printer);
p.drawPixmap(85, 32, qpm);
p.end();
}
}
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();
}
}
To copy to clipboard, switch view to plain text mode
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
Bookmarks