Skip to content

Commit

Permalink
refs #7263
Browse files Browse the repository at this point in the history
refs #6856
Reset QPrinter to circumvent PDF corruption bug
  • Loading branch information
Hugo Mercier committed Mar 4, 2013
1 parent e2bf9c6 commit 7db1b60
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -748,12 +748,16 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
}
if ( !atlasOnASingleFile )
{
// bugs #7263 and #6856
// QPrinter does not seem to be reset correctly and may cause generated PDFs (all except the first) corrupted
// when transparent objects are rendered. We thus use a new QPrinter object here
QPrinter multiFilePrinter;
outputFileName = QDir( outputDir ).filePath( atlasMap->currentFilename() ) + ".pdf";
mComposition->beginPrintAsPDF( printer, outputFileName );
mComposition->beginPrintAsPDF( multiFilePrinter, outputFileName );
// set the correct resolution
mComposition->beginPrint( printer );
painter.begin( &printer );
mComposition->doPrint( printer, painter );
mComposition->beginPrint( multiFilePrinter );
painter.begin( &multiFilePrinter );
mComposition->doPrint( multiFilePrinter, painter );
painter.end();
}
else
Expand Down

0 comments on commit 7db1b60

Please sign in to comment.