Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

QtPDF Build Instructions: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(typo)
(Mention html5lib dependency)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
QtPdf binaries are provided via [https://marketplace.qt.io/products/qtpdf Marketplace] for convenience; but you can also build it yourself.
QtPdf binaries are provided via [https://marketplace.qt.io/products/qtpdf Marketplace] for convenience; but you can also build it yourself.


== Building the 5.15 version ==
==Building the 5.15 version==


* 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:


<code>
<pre>
$ git clone https://code.qt.io/qt/qtwebengine.git
$ git clone https://code.qt.io/qt/qtwebengine.git
$ cd qtwebengine
$ cd qtwebengine
$ git checkout 5.15.0
$ git checkout 5.15
$ git submodule update --init --recursive
$ git submodule update --init --recursive
$ cd ..
$ cd ..
</code>
</pre>


* fortunately build of QtWebEngine itself is not necessary for QtPdf build, therefore let's configure shadow build with:
*fortunately build of QtWebEngine itself is not necessary for QtPdf build; therefore let's configure shadow build with:


<code>
<pre>
$ mkdir build
$ mkdir build
$ cd build
$ cd build
$ qmake ../qtwebengine -- -no-build-qtwebengine-core
$ qmake ../qtwebengine -- -no-build-qtwebengine-core
</code>
</pre>


* you should see configuration summary after previous step:  
*you should see configuration summary after previous step:


<code>
<pre>
Configure summary:  
Configure summary:  


Line 85: Line 85:
Once everything is built, you must run 'make install'.  
Once everything is built, you must run 'make install'.  
Qt will be installed into '/usr'.
Qt will be installed into '/usr'.
</code>
</pre>


* QtPdf build will use '''gn''' and '''ninja''' to build Pdfium which is required or QtPdf module, let's perform the build:
*QtPdf build will use '''gn''' and '''ninja''' to build Pdfium which is required for the QtPdf module.  Let's perform the build:


<code>
<pre>
$ NINJAJOBS=-j4 make -j4 && make install
$ NINJAJOBS=-j4 make -j4 && make install
</code>
</pre>
 
==Building the 6.3 version==
 
*sources for QtPdf module are hosted within QtWebEngine repository. Let's clone and initialize the git repository:
 
<pre>
$ git clone https://code.qt.io/qt/qtwebengine.git
$ cd qtwebengine
$ git checkout 6.3
$ git submodule update --init --recursive
$ cd ..
</pre>
 
* Install html5lib:
 
pip3 install html5lib
 
*configure shadow build with:
 
<pre>
$ mkdir build
$ cd build
$ qt-configure-module ../qtwebengine -- -DFEATURE_qtwebengine_build=OFF
</pre>
 
*build the pdf
 
<pre>
$ cmake --build . --parallel
</pre>


Since QtPdf comes with Qml and Widget APIs examples using those can be found in examples/pdf and examples/pdfwidgets.
Since QtPdf comes with Qml and Widget APIs examples using those can be found in examples/pdf and examples/pdfwidgets.


'''In case of any issues please open bug report for PDF component in https://bugreports.qt.io/ using PDF as component.'''
'''In case of any issues please open bug report for PDF component in https://bugreports.qt.io/<nowiki/>.'''


== Historical repository ==
==Historical repository==


The older version in the [https://code.qt.io/cgit/qt-labs/qtpdf.git/ Qt Labs QtPDF repository] still exists, but development now continues in the [https://code.qt.io/cgit/qt/qtwebengine.git/tree/src/pdf qtwebengine repository].  This was prompted mainly by the upstream Chromium switch of build system from gyp to gn system: it was some work to get qtwebengine building with that.  Chromium (and thus Qt WebEngine) include PDFium already; so it was easier to build QtPDF from there than to fix the build in the other repository.
The older version in the [https://code.qt.io/cgit/qt-labs/qtpdf.git/ Qt Labs QtPDF repository] still exists, but development now continues in the [https://code.qt.io/cgit/qt/qtwebengine.git/tree/src/pdf 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.

Latest revision as of 08:59, 27 June 2023

QtPdf binaries are provided via Marketplace for convenience; but you can also build it yourself.

Building the 5.15 version

  • 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 5.15
$ git submodule update --init --recursive
$ cd ..
  • fortunately build of QtWebEngine itself is not necessary for QtPdf build; therefore let's configure shadow build with:
$ mkdir build
$ cd build
$ qmake ../qtwebengine -- -no-build-qtwebengine-core
  • you should see configuration summary after previous step:
Configure summary: 

Qt WebEngine Build Tools:
  Use System Ninja ....................... yes
  Use System Gn .......................... no
  Jumbo Build Merge Limit ................ 8
  Developer build ........................ no
  QtWebEngine required system libraries:
    fontconfig ........................... yes
    dbus ................................. yes
    nss .................................. yes
    khr .................................. yes
    glibc ................................ yes
  QtWebEngine required system libraries for qpa-xcb:
    x11 .................................. yes
    libdrm ............................... yes
    xcomposite ........................... yes
    xcursor .............................. yes
    xi ................................... yes
    xtst ................................. yes
  Optional system libraries used:
    re2 .................................. yes
    icu .................................. no
    libwebp, libwebpmux and libwebpdemux . yes
    opus ................................. yes
    ffmpeg ............................... no
    libvpx ............................... yes
    snappy ............................... yes
    glib ................................. yes
    zlib ................................. yes
    minizip .............................. yes
    libevent ............................. yes
    jsoncpp .............................. yes
    protobuf ............................. yes
    libxml2 and libxslt .................. yes
    lcms2 ................................ yes
    png .................................. yes
    JPEG ................................. yes
    harfbuzz ............................. yes
    freetype ............................. yes
    xkbcommon ............................ 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
Qt PDF Widgets:
  Support Qt PDF Widgets ................. yes

Note: QtWebEngine build is disabled by user.

Note: The following modules are not being compiled in this configuration:
    webenginecore
    webengine
    webenginewidgets

Qt is now configured for building. Just run 'make'. 
Once everything is built, you must run 'make install'. 
Qt will be installed into '/usr'.
  • QtPdf build will use gn and ninja to build Pdfium which is required for the QtPdf module. Let's perform the build:
$ NINJAJOBS=-j4 make -j4 && make install

Building the 6.3 version

  • 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.3
$ git submodule update --init --recursive
$ cd ..
  • Install html5lib:
pip3 install html5lib
  • configure shadow build with:
$ mkdir build
$ cd build
$ qt-configure-module ../qtwebengine -- -DFEATURE_qtwebengine_build=OFF
  • build the pdf
$ cmake --build . --parallel

Since QtPdf comes with Qml and Widget APIs examples using those can be 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.