Skip to content

Commit

Permalink
Merge pull request #8 from MrMartinIden/master
Browse files Browse the repository at this point in the history
Fixed double-sided printing
  • Loading branch information
aizenbit authored Sep 23, 2018
2 parents 82bdc7e + 76dff66 commit b390a23
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,8 @@ void MainWindow::printAllSheets()
{ //i.e. while printing all sheets
renderNextSheet();

if (printer.fromPage() != 0 && printer.fromPage() > currentSheetNumber + 1)
continue;
if (printer.toPage() != 0 && printer.toPage() < currentSheetNumber + 1)
if ((printer.fromPage() != 0 && printer.fromPage() > currentSheetNumber + 1) //we're not going out of page range
|| (printer.toPage() != 0 && printer.toPage() < currentSheetNumber + 1)) //defined by user
continue;

QImage image = ui->svgView->saveRenderToImage();
Expand All @@ -499,11 +498,9 @@ void MainWindow::printAllSheets()

painter.drawImage(0, 0, image);

if (ui->toolBar->actions()[ToolButton::Next]->isEnabled() //if "Next Sheet" tool button is enabled,
&& (printer.toPage() != 0 //i.e this sheet is not the last,
&& currentSheetNumber + 1 < printer.toPage())) //and we're not going out of page range
printer.newPage(); //defined by user
}
if (ui->toolBar->actions()[ToolButton::Next]->isEnabled()) //if "Next Sheet" tool button is enabled,
printer.newPage(); //i.e this sheet is not the last,
}

painter.end();
ui->svgView->hideBorders(false);
Expand Down Expand Up @@ -554,6 +551,7 @@ void MainWindow::preparePrinter(QPrinter *printer)
printer->setPaperSize(paperSize, QPrinter::Millimeter);
printer->setResolution(settings.value("dpi", 300).toInt());
printer->setOrientation(isPortrait ? QPrinter::Portrait : QPrinter::Landscape);
printer->setDoubleSidedPrinting(true);

settings.endGroup();
}
Expand Down

0 comments on commit b390a23

Please sign in to comment.