Need to implement Print Dialog Box
I need to implement a Print Dialog box which on clicking a button will pop up and ask for printer configuration. How can I do it in Python?
from PyQt5.QtPrintSupport import QPrintDialog
I am using the following code. But I am getting print in small size i.e. the whole widget is coming in smaller area of the page.
def print_widget(self): printer = QtPrintSupport.QPrinter() setupdialog = QPrintDialog(printer,self) if setupdialog.exec_() == QPrintDialog.Accepted: painter = QtGui.QPainter(self) painter.begin(printer) point = QtCore.QPoint(0,0) screen = self.grab() self.pixmap = QtGui.QPixmap(screen) scaledPix = self.pixmap.scaled(1100,950,Qt.KeepAspectRatio,transformMode = Qt.SmoothTransformation) point.setX(0) point.setY(0) painter.drawPixmap(point, scaledPix) painter.end()
Sorry I don't know. But this question has nothing to do with the
QPrintDialogyou ask about in the title, it's to do with drawing to a
Did you try other sizes for scaled()?
Its the same as here
Screen is normally maybe 1920x1080 pixels
where as printer might
be 9000 x 9000 pixels
So if you have an image of 200x200
on screen it look ok big.
But if you print it. then 200 pixels out of 9000 looks like the size
of a stamp.