QtPDF Build Instructions: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 51: | Line 51: | ||
... | ... | ||
-- Configuration summary has been written to /home/username/Qt/6.12.0/Src/qtwebengine/config.summary | -- Configuration summary has been written to /home/username/Qt/6.12.0/Src/qtwebengine/config.summary | ||
... | |||
-- Configuring done (14.0s) | |||
-- Generating done (0.1s) | |||
-- Build files have been written to: /home/username/Qt/6.12.0/Src/qtwebengine/build | |||
$ cat | $ cat config.summary | ||
WebEngine Repository Build Options: | WebEngine Repository Build Options: | ||
Build Gn ............................... yes | Build Gn ............................... yes | ||
Revision as of 14:57, 18 August 2026
Qt PDF binaries are available from the Qt installer; but here's how to build it yourself.
In case of any issues, please open a bug report for the PDF component at https://bugreports.qt.io/.
Building with an existing Qt 6
- Install html5lib:
$ apt install python3-html5lib
or
$ pip3 install html5lib
- sources for the Qt PDF module are hosted within QtWebEngine repository. Let's clone and initialize the git repository (currently about 7.1 GB):
$ git clone https://code.qt.io/qt/qtwebengine.git $ cd qtwebengine $ git checkout 6.12 (or whatever version) $ git submodule update --init --recursive
- fortunately build of QtWebEngine itself is not necessary for Qt PDF. Configure a shadow build:
$ mkdir build $ cd build $ qt-configure-module ../qtwebengine -- -DQT_FEATURE_qtwebengine_build=OFF
- build Qt PDF
$ cmake --build . --parallel
Qt PDF comes with Qml and Widget APIs examples, found in examples/pdf and examples/pdfwidgets.
Building from source installed with the installer
In Qt Maintenance Tool (AKA the installer) you can choose Extensions | Qt PDF | Qt 6.xx.x | Desktop to get the already-built version, and/or Extensions | Qt WebEngine | Qt 6.xx.x | Sources to get the source code for Qt WebEngine and Qt PDF together.
- configure a shadow build
$ cd ~/Qt/6.12.0/Src/qtwebengine (or whatever version)
$ mkdir build
$ cd build
$ qt-configure-module .. -- -DQT_FEATURE_qtwebengine_build=OFF
...
-- Configuration summary has been written to /home/username/Qt/6.12.0/Src/qtwebengine/config.summary
...
-- Configuring done (14.0s)
-- Generating done (0.1s)
-- Build files have been written to: /home/username/Qt/6.12.0/Src/qtwebengine/build
$ cat config.summary
WebEngine Repository Build Options:
Build Gn ............................... yes
Jumbo Build ............................ yes
Developer build ........................ no
Build with rust ........................ no
Use precompiled headers for 3rdparty ... no
Build QtWebEngine Modules:
Build QtWebEngineCore ................ no
Build QtWebEngineWidgets ............. no
Build QtWebEngineQuick ............... no
Build QtPdf Modules:
Build QtPdfWidgets ................... yes
Build QtPdfQuick ..................... yes
Optional system libraries:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . yes
opus ................................. yes
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... yes
glib ................................. yes
zlib ................................. yes
minizip .............................. yes
libxml2 and libxslt .................. yes
lcms2 ................................ yes
png .................................. no
tiff ................................. yes
jpeg ................................. no
libopenjpeg2 ......................... yes
harfbuzz ............................. no
freetype ............................. yes
libpci ............................... yes
libudev .............................. yes
openh264 ............................. yes
Qt PDF:
Support V8 ............................. no
Support XFA ............................ no
Support XFA-BMP ........................ no
Support XFA-GIF ........................ no
Support XFA-PNG ........................ no
Support XFA-TIFF ....................... no
Bitcode support ........................ no
Use static runtime ..................... no
SBOM:
Generate SBOM .......................... yes
Generate SPDX v2.3 ..................... yes
Generate SPDX v2.3 JSON ................ yes (skipped if dependencies are missing)
Verify SPDX v2.3 JSON ................ yes (skipped if dependencies are missing)
Generate CycloneDX v1.6 ................ no (skipped if dependencies are missing)
Verify CycloneDX v1.6 ................ yes (skipped if dependencies are missing)
SBOM Python interpreter ................ Not found
Generate source SPDX SBOM .............. no
Note:
Scanning for ide sources...
Please note configure can execute faster if called with:
'qt-configure-module path/to/src -- -DQT_SHOW_EXTRA_IDE_SOURCES=OFF'
WARNING: Qt WebEngine And Qt Pdf SBOM generation will be skipped due to missing dependencies. QT_INTERNAL_SBOM_PYTHON_EXECUTABLE is missing a valid path to a python interpreter
Required Python dependencies NOT found: spdx_tools.spdx.clitools.pyspdxtools
- build
$ cmake --build . --parallel
Building Qt and Qt PDF together
- get the qt5.git repository, submodules and dependencies as explained in Building Qt 6 from Git
- configure and build a shadow build:
$ cd .. $ mkdir qt6-dbg $ cd qt6-dbg $ ../qt6/configure -developer-build -debug -no-optimize-debug -nomake examples -make tests -no-pch -submodules qtbase,qtdeclarative,qtshadertools,qtwebengine -no-feature-qtwebengine-build $ ninja
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 Qt PDF from there than to fix the build in the other repository.