Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Disable page count in QTextDocument



  • Hello,

    When i print the content of a QTextDocument i get a "1" printed in the bottom of the PDF.

    How can i disable the page count at the bottom of the document?

    Regards
    Filipe V.



  • The documentation says "If the document is already paginated through a specified height in the pageSize() property it is printed as-is.":http://qt-project.org/doc/qt-5/qtextdocument.html#print
    And if it is not paginated then "the current page number is printed at the bottom of each page."

    I think you need to call
    @void QTextDocument::setPageSize(const QSizeF & size)@

    before calling
    @void QTextDocument::print(QPagedPaintDevice * printer) const@



  • Hello andreyc,

    setPageSize does not disable pageCount, i solved this by changing the source code of the QTextDocument to remove the pageCount.

    Just comment @if (!pageNumberPos.isNull()) {@ in the qtextdocument.cpp file.



  • Hi filipeval,

    Thank you for sharing your solution.


Log in to reply