Important: Please read the 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?

    Filipe V.

  • The documentation says "If the document is already paginated through a specified height in the pageSize() property it is printed as-is.":
    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