Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

332.1. pdf4qt-1.6.0.0

PDF viewer and editor — annotate, redact, sign, compare, split and merge pages

Version 1.6.0.0, release 2
Shelf documents — PDF, PostScript, DjVu, EPUB, CHM and DOCX viewers, libraries and tools, and ebook managers
Phase 44_apps (Applications), 65 of 422 in build order
Licence MIT
Homepage https://jakubmelka.github.io/
Build time 35.9 SBU
Installed size 22.6 MiB in 158 files
Recipe ports/core/documents/pdf4qt/kpkgbuild

About

PDF4QT is a PDF suite on Qt 6 with its own rendering library: a viewer, an editor that annotates, redacts, fills forms and signs, PageMaster for merging, splitting and reordering pages, and Diff for comparing two documents. Each is its own program (Pdf4QtViewer, Pdf4QtEditor, Pdf4QtPageMaster, Pdf4QtDiff), with Pdf4QtLaunchPad to choose between them. It requires blend2d, a 2D vector rasteriser, and onetbb at configure time, and reads text aloud through Qt Speech.

Sources

Dependencies

Depends on: cmake, ninja, qt6-qtbase, qt6-qtsvg, qt6-qtspeech, qt6-qttools, qt6-qtwayland, openssl, zlib, freetype2, openjpeg, libjpeg-turbo, libpng, lcms2, blend2d, onetbb, sane-backends.

Required by: no port names it.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install pdf4qt'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/documents/pdf4qt.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/documents/pdf4qt
echo 'a5f9952723acbb8a2431207cf76e53a17941292fbd003a2ed1b79503677ab2ec  pdf4qt-1.6.0.0.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/pdf4qt
SRC=$SRC_ROOT/pdf4qt-1.6.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf pdf4qt-1.6.0.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/openssl4.patch"

cmake -S . -B build -G Ninja \
	-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D CMAKE_INSTALL_LIBDIR=lib \
	-D CMAKE_BUILD_TYPE=Release \
	-D PDF4QT_BUILD_TESTS=OFF \
	-D PDF4QT_INSTALL_DEPENDENCIES=OFF \
	-D PDF4QT_INSTALL_QT_DEPENDENCIES=OFF \
	-D PDF4QT_INSTALL_TO_USR=OFF \
	-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build

_apps="$PKG/usr/share/applications"
_entry() {
	cat > "$_apps/io.github.JakubMelka.Pdf4qt.$1.desktop" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=$2
Comment=$3
Exec=$1${4:+ $4}
Icon=io.github.JakubMelka.Pdf4qt.$1
Terminal=false
Categories=Office;
${4:+MimeType=application/pdf;
}StartupWMClass=$1
EOF
}
_entry Pdf4QtViewer 'PDF4QT Viewer' 'View and navigate PDF documents' %f
_entry Pdf4QtEditor 'PDF4QT Editor' 'Edit and modify PDF files' %f
_entry Pdf4QtPageMaster 'PDF4QT PageMaster' \
	'Organize, merge, split, and duplicate pages in PDF files'
_entry Pdf4QtDiff 'PDF4QT Diff' 'Compare PDF documents' %F
cat > "$_apps/io.github.JakubMelka.Pdf4qt.desktop" <<'EOF'
[Desktop Entry]
Version=1.0
Type=Application
Name=PDF4QT LaunchPad
Comment=Launch PDF applications
Exec=Pdf4QtLaunchPad
Icon=io.github.JakubMelka.Pdf4qt
Terminal=false
NoDisplay=true
Categories=Office;
StartupWMClass=Pdf4QtLaunchPad
EOF

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/pdf4qt, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf pdf4qt-1.6.0.0-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/pdf4qt, and runs the triggers its paths call for.

Contents

Installed programs: Pdf4QtDiff, Pdf4QtEditor, Pdf4QtLaunchPad, Pdf4QtPageMaster, Pdf4QtViewer, PdfTool.

Installed libraries: libPdf4QtLibCore.so, libPdf4QtLibGui.so, libPdf4QtLibWidgets.so.

Installed directories: /usr/include/Pdf4QtLibCore, /usr/include/Pdf4QtLibWidgets, /usr/lib/pdf4qt, /usr/share/licenses/pdf4qt, /usr/share/pdf4qt.

Notes

Upstream installs a desktop entry for each program. build.sh writes its own over them, adding %f to the Viewer’s and Editor’s Exec and %F to Diff’s, so a file opened from the file manager reaches the program, and a StartupWMClass for each. Upstream’s entries all claim application/pdf; the port’s keep that only for the three that take a file, so PageMaster and the LaunchPad are not offered for opening a PDF, and the LaunchPad’s entry has NoDisplay=true, which the menu then leaves out.