How to start a new page in PDF?
In my project I'm usign QTextEdit object to write data in it and QPrinter object to write all the data resides in the QTextEdit to a PDF file. Problem is about tables, I can add tables to QTextEdit, however, when QPrint is writing them to file it can seperate tables to 2 pages. In example, lets say there is a table with 10 rows and the cursor is located somewhere near to the bottom of the first page. When QPrinter tries to write the table, it writes first 2 rows to the end of the first page and writes other rows to the following (here is second) page. But I want to write 1 table for 1 page. How can I add something like page seperator (or something like new page)?
Here is writer portion of the code
Triggering the printer to start a new page is easy: simply call printer::newPage().
Making QTextEdit do that at the moment you want it to is a completely different, and much more complicated issue. QTextEdit is really focussed on doing a layout of a document as a single page. We ended up not using it for our reporting needs and instead implemented our own report engine based on QML templates.
Thanks for your reply. I've solved the problem by using a QPainter object.
I have the similar problem and I am stuck from last 4 days.
Pease tell me where I'm going wrong. here is my coding for converting html to pdf.
Thanking you in advance..!!
app = QApplication(sys.argv)
web = QWebView()
printer = QPrinter()
printer = QPrinter(QPrinterInfo.defaultPrinter(),QPrinter.HighResolution) # QtGui.QPrinter(QtGui.QPrinter.HighResolution)
print "Pdf Generated"