Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61032

Support for headers/footers in printToPdf

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.7.1
    • WebEngine
    • None
    • Windows 7 through 10
      Qt 5.7.1

    Description

      We currently use wkhtmltopdf's C++ library to convert HTML to a PDF. However it has various bugs, such as fonts being compressed horizontally and rendering too large.

      I tested with

      QWebEnginePage->printToPdf()

      and it does not have these font issues; it renders correctly. However, Qt's printToPdf() does not support headers/footers, and it adds a "PAGE 2:" label at the top-left page 2 (and so on for each page), and there is no way to disable or customize this.

      It would be a perfect solution for us if there were a way to specify custom headers/footers per page (I supply the HTML). Long-term we'd need to be able to have different headers/footers used depending on the pager number.

      The way I see this working is I provide getHeader(short pageNum) and getFooter(short pageNum) callbacks to printToPdf() that return HTML for those headers/footers. I'd also need to be able to specify margins and how much of the page the header/footer takes up.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            vern.jensen Vern
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes