Jump to content

QtPDF Build Instructions: Difference between revisions

From Qt Wiki
Shawnrutledge (talk | contribs)
remove Qt 5 info; genericize for whatever Qt 6 version
Shawnrutledge (talk | contribs)
m remove "cd .."
Line 5: Line 5:
* Install html5lib:
* Install html5lib:


  apt install python3-html5lib
  $ apt install python3-html5lib


or
or


  pip3 install html5lib
  $ pip3 install html5lib


*sources for QtPdf module are hosted within QtWebEngine repository. Let's clone and initialize the git repository:
*sources for QtPdf module are hosted within QtWebEngine repository. Let's clone and initialize the git repository:
Line 18: Line 18:
$ git checkout 6.12 (or whatever version)
$ git checkout 6.12 (or whatever version)
$ git submodule update --init --recursive
$ git submodule update --init --recursive
$ cd ..
</pre>
</pre>



Revision as of 13:55, 18 August 2026

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
  • 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.