Jump to content

QtPDF Build Instructions

From Qt Wiki
Revision as of 13:52, 18 August 2026 by Shawnrutledge (talk | contribs) (remove Qt 5 info; genericize for whatever Qt 6 version)

QtPdf binaries are available from the Qt installer; but here's how to build it yourself.

Building with an existing Qt 6

  • Install html5lib:
apt install python3-html5lib

or

pip3 install html5lib
  • sources for QtPdf module are hosted within QtWebEngine repository. Let's clone and initialize the git repository:
$ git clone https://code.qt.io/qt/qtwebengine.git
$ cd qtwebengine
$ git checkout 6.12 (or whatever version)
$ git submodule update --init --recursive
$ cd ..
  • fortunately build of QtWebEngine itself is not necessary for QtPdf. Configure a shadow build:
$ mkdir build
$ cd build
$ qt-configure-module ../qtwebengine -- -DFEATURE_qtwebengine_build=OFF
  • build QtPdf
$ cmake --build . --parallel

QtPdf comes with Qml and Widget APIs examples, found in examples/pdf and examples/pdfwidgets.

In case of any issues please open bug report for PDF component in https://bugreports.qt.io/.

Historical repository

The older version in the Qt Labs QtPDF repository still exists, but development now continues in the qtwebengine repository. This was prompted mainly by the upstream Chromium switch of build system from gyp to gn: it was some work to get qtwebengine building with that. Chromium (and thus Qt WebEngine) includes PDFium already; so it was easier to build QtPDF from there than to fix the build in the other repository.