Skip to content

Commit

Permalink
Print with full page mode only when margin is not (0, 0, 0, 0)
Browse files Browse the repository at this point in the history
Print with full page mode only when margin is not (0, 0, 0, 0), since when full page mode is enabled, the margin will be ignored. Base on http://doc.qt.io/qt-5/qprinter.html#setPageMargins .
  • Loading branch information
socrateslee committed Jul 29, 2015
1 parent 7fc7c68 commit 7a6761f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ghost/ghost.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,8 @@ def print_to_pdf(
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setPaperSize(QtCore.QSizeF(*paper_size), paper_units)
printer.setPageMargins(*(paper_margins + (paper_units,)))
printer.setFullPage(True)
if paper_margins != (0, 0, 0, 0):
printer.setFullPage(True)
printer.setOutputFileName(path)
if self.webview is None:
self.webview = QtWebKit.QWebView()
Expand Down

0 comments on commit 7a6761f

Please sign in to comment.