Skip to content

Commit

Permalink
Print only requested pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jul 18, 2012
1 parent 171ae62 commit fb10f1b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core/composer/qgscomposition.cpp
Expand Up @@ -1260,11 +1260,15 @@ void QgsComposition::print( QPrinter &printer )

QPainter p( &printer );

//QgsComposition starts page numbering at 0
int fromPage = ( printer.fromPage() < 1 ) ? 0 : printer.fromPage() - 1 ;
int toPage = ( printer.toPage() < 1 ) ? numPages() - 1 : printer.toPage() - 1;

if ( mPrintAsRaster )
{
for ( int i = 0; i < numPages(); ++i )
for ( int i = fromPage; i <= toPage; ++i )
{
if ( i > 0 )
if ( i > fromPage )
{
printer.newPage();
}
Expand All @@ -1280,9 +1284,9 @@ void QgsComposition::print( QPrinter &printer )

if ( !mPrintAsRaster )
{
for ( int i = 0; i < numPages(); ++i )
for ( int i = fromPage; i <= toPage; ++i )
{
if ( i > 0 )
if ( i > fromPage )
{
printer.newPage();
}
Expand Down

0 comments on commit fb10f1b

Please sign in to comment.