Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to print the current tab on pressing a Push Button?
Piyush last edited by Piyush
I need to print the current tab on pressing the push button. Also, I need to add functionality wherein after the button is pressed, the UI would ask for print or save in PDF.
You can use the print class for that
@mrjj Thanks for the help. I am unable to print the whole QDialog in a single page. In fact I have changed the orientation, margins and fullpage.
ok, is that a question or ?
You can scale it to fit one page. or that is to compressed to read ?
Its hard(er) to print image over multiple pages.
@mrjj I need to print a whole tab in a single A4 page. But the printer is giving print displaying partial tab. So How can I do it?
You might need to scale the image so it fits the page.
I tried doing it, but still there is only partial print of tab. Is there any way by which I can pass the current tab in the print function? This is the code I am using:
printer = QtPrintSupport.QPrinter()
painter = QtGui.QPainter()
screen = self.grab()
I dont see any scaling ?
painter.drawPixmap(0,0, screen) just seem to draw the image as is.
if you do
painter.drawPixmap(0,0, screen.scaled(screen.width()/2, screen.height() /2 ) )
it should draw in half the size
its c++ syntax. im not python user but should be pretty close.