I have tried to remove the page numbering in my page preview, but it when I tried to set the page size to the document it does not display the content to visualize. If someone can help me to determinate if is possible create a widget that the user the hit when they desire to numbering or not the pages.
enter image description here
The code is the following
` def auto_num_checked(self):
value = self.auto_check_box.checkState()
self.auto_check_box.setChecked(value)
def prin_preview(self):
"""
This funciton create a window that allows to the customer customize his page size
:return: QPrinter
"""
self.preview_page_dialog = QPrintPreviewDialog()
self.preview_page_dialog.setWindowIcon(QIcon("Icons/Main_logo.png"))
self.preview_page_dialog.paintRequested.connect(self.prepare_the_document_to_visualize)
self.preview_page_dialog.exec_()
def prepare_the_document_to_visualize(self,printer: QPrinter):
self.printer = printer
self.printer.setDocName(f"{self.windowTitle()} - " + str(self.current_tab_info.name))
self.document = self.current_plain_text_widget.document()
self.printer.setPageSize(QPageSize(QPageSize.Letter))
self.document.setPageSize(QtCore.QSizeF(self.printer.width(), self.printer.height()))
self.document.print_(self.printer)
def print_document(self):
self.printer = QPrinter()
dialog_printer = QPrintDialog(self.printer)
if dialog_printer.exec_():
self.printer.setDocName(f"{self.windowTitle()} - " + str(self.current_tab_info.name))
self.document = self.current_plain_text_widget.document()
self.document.print_(self.printer)`
Reeive an answer that can resolve my issue