Merge branch 'qgis:master' into improve-doc

This commit is contained in:
Valentin Buira 2025-09-25 13:48:47 +02:00 committed by GitHub
commit 4adfec7e43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1385 changed files with 79760 additions and 11324 deletions

View File

@ -21,6 +21,7 @@ cmake -GNinja \
-DWITH_QUICK=OFF \
-DWITH_3D=OFF \
-DWITH_STAGED_PLUGINS=OFF \
-DBUILD_WITH_QT6=OFF \
-DWITH_GRASS=OFF \
-DENABLE_MODELTEST=OFF \
-DENABLE_PGTEST=OFF \
@ -39,6 +40,7 @@ cmake -GNinja \
-DWITH_ORACLE=OFF \
-DWITH_PDAL=OFF \
-DWITH_QTPRINTER=OFF \
-DWITH_QTWEBENGINE=OFF \
-DDISABLE_DEPRECATED=ON \
-DCXX_EXTRA_FLAGS="${CLANG_WARNINGS}" \
-DCMAKE_C_COMPILER=/bin/clang \

View File

@ -104,8 +104,6 @@ else
${VOLUMES} \
--env-file .docker/docker-variables.env \
--env PUSH_TO_CDASH=false \
--env WITH_QT5=true \
--env BUILD_WITH_QT6=false \
--env WITH_QUICK=false \
--env WITH_3D=false \
--env PATCH_QT_3D=false \

View File

@ -1,39 +0,0 @@
# Qt6 blocklist
test_core_compositionconverter
test_core_layoutpicture
test_app_advanceddigitizing
test_app_vertextool
# Crashes -- also disabled on qt5 builds!
test_gui_queryresultwidget
# code layout tests are run on separate build
qgis_spelling
qgis_sipify
qgis_sip_include
qgis_sip_uptodate
# Need a local postgres installation
PyQgsAuthManagerOgrPostgresTest
PyQgsDbManagerPostgis
# Needs an OpenCL device, the library is not enough
test_core_openclutils
# Relies on a broken/unreliable 3rd party service
test_core_layerdefinition
# MSSQL requires the MSSQL docker
PyQgsProviderConnectionMssql
PyQgsStyleStorageMssql
# To be fixed
PyQgsAnnotation
PyQgsAuthenticationSystem
PyQgsEditWidgets
PyQgsLayoutHtml
PyQgsPalLabelingPlacement
PyQgsRasterLayerRenderer
PyQgsSettings
PyQgsSettingsEntry
ProcessingQgisAlgorithmsTestPt4

View File

@ -0,0 +1,19 @@
# Crashes -- also disabled on ubuntu builds!
test_gui_queryresultwidget
# code layout tests are run on separate build
qgis_spelling
qgis_sipify
qgis_sip_include
qgis_sip_uptodate
# Need a local postgres installation
PyQgsAuthManagerOgrPostgresTest
PyQgsDbManagerPostgis
# Needs an OpenCL device, the library is not enough
test_core_openclutils
# Relies on a broken/unreliable 3rd party service
test_core_layerdefinition

View File

@ -0,0 +1,18 @@
# block list
test_gui_queryresultwidget
# code layout tests are run on separate build
qgis_spelling
qgis_sipify
qgis_sip_include
qgis_sip_uptodate
# Need a local postgres installation
PyQgsAuthManagerOgrPostgresTest
PyQgsDbManagerPostgis
# Needs an OpenCL device, the library is not enough
test_core_openclutils
# Relies on a broken/unreliable 3rd party service
test_core_layerdefinition

View File

@ -52,9 +52,7 @@ if [[ "${WITH_CLAZY}" = "ON" ]]; then
export CLAZY_IGNORE_DIRS="(.*/external/.*)|(.*sip_.*part.*)"
fi
if [[ ${BUILD_WITH_QT6} = "ON" ]]; then
CLANG_WARNINGS="-Wrange-loop-construct"
fi
CLANG_WARNINGS="-Wrange-loop-construct"
CMAKE_EXTRA_ARGS=()
@ -70,11 +68,9 @@ if [[ ${WITH_GRASS7} == "ON" || ${WITH_GRASS8} == "ON" ]]; then
)
fi
if [[ ${BUILD_WITH_QT6} = "ON" ]]; then
CMAKE_EXTRA_ARGS+=(
"-DUSE_ALTERNATE_LINKER=mold"
)
fi
CMAKE_EXTRA_ARGS+=(
"-DUSE_ALTERNATE_LINKER=mold"
)
cmake \
-GNinja \
@ -82,7 +78,6 @@ cmake \
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} \
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} \
-DUSE_CCACHE=ON \
-DBUILD_WITH_QT6=${BUILD_WITH_QT6} \
-DWITH_DESKTOP=ON \
-DWITH_ANALYSIS=ON \
-DWITH_GUI=ON \
@ -110,11 +105,10 @@ cmake \
-DWITH_SERVER=ON \
-DWITH_SERVER_LANDINGPAGE_WEBAPP=${WITH_SERVER_LANDINGPAGE_WEBAPP} \
-DWITH_ORACLE=ON \
-DWITH_PDAL=ON \
-DWITH_PDAL=${WITH_PDAL} \
-DWITH_QTSERIALPORT=ON \
-DWITH_QTWEBKIT=${WITH_QT5} \
-DWITH_QTWEBENGINE=${WITH_QTWEBENGINE} \
-DWITH_PDF4QT=${WITH_PDF4QT} \
-DWITH_SFCGAL=${WITH_SFCGAL} \
-DORACLE_INCLUDEDIR=/instantclient_21_16/sdk/include/ \
-DORACLE_LIBDIR=/instantclient_21_16/ \
-DDISABLE_DEPRECATED=ON \

View File

@ -10,7 +10,7 @@ cd ${SRCDIR}
git config --global --add safe.directory ${SRCDIR}
usage() {
echo "Usage; $(basename $0) [<TEST_BATCHNAME>]"
echo "Usage; $(basename $0) [<TEST_BATCHNAME>] [<TEST_BLOCKLIST_FILE>]"
echo "TEST_BATCHNAME can be any of:"
echo " HANA Test the HANA provider"
echo " POSTGRES Test the PostgreSQL provider"
@ -20,23 +20,23 @@ usage() {
echo " ALL (default) Run all tests"
}
if [ $# -eq 1 ] && [ $1 = "HANA" ]; then
if [ $# -ge 1 ] && [ $1 = "HANA" ]; then
LABELS_TO_RUN="HANA"
RUN_HANA=YES
elif [ $# -eq 1 ] && [ $1 = "POSTGRES" ]; then
elif [ $# -ge 1 ] && [ $1 = "POSTGRES" ]; then
LABELS_TO_RUN="POSTGRES"
RUN_POSTGRES=YES
elif [ $# -eq 1 ] && [ $1 = "ORACLE" ]; then
elif [ $# -ge 1 ] && [ $1 = "ORACLE" ]; then
LABELS_TO_RUN="ORACLE"
RUN_ORACLE=YES
elif [ $# -eq 1 ] && [ $1 = "SQLSERVER" ]; then
elif [ $# -ge 1 ] && [ $1 = "SQLSERVER" ]; then
LABELS_TO_RUN="SQLSERVER"
RUN_SQLSERVER=YES
elif [ $# -eq 1 ] && [ $1 = "ALL_BUT_PROVIDERS" ]; then
elif [ $# -ge 1 ] && [ $1 = "ALL_BUT_PROVIDERS" ]; then
LABELS_TO_EXCLUDE="HANA|POSTGRES|ORACLE|SQLSERVER"
elif [ $# -gt 0 ] && [ $1 != "ALL" ]; then
@ -51,6 +51,10 @@ else
RUN_SQLSERVER=YES
fi
if [ $# -ge 2 ]; then
BLOCKLIST=${SRCDIR}/$2
fi
# Debug env
echo "::group::Print env"
env
@ -270,10 +274,15 @@ fi
###########
# Run tests
###########
EXCLUDE_TESTS="^$(cat ${SRCDIR}/.ci/test_blocklist_qt${QT_VERSION}.txt | sed -r '/^(#.*?)?$/d' | paste -sd '~' | sed -r 's/~/\$|^/g' -)\$"
if [[ -n ${BLOCKLIST} ]]; then
EXCLUDE_TESTS="^$(cat ${BLOCKLIST} | sed -r '/^(#.*?)?$/d' | paste -sd '~' | sed -r 's/~/\$|^/g' -)\$"
fi
if ! [[ ${RUN_FLAKY_TESTS} == true ]]; then
echo "Flaky tests are skipped!"
EXCLUDE_TESTS=${EXCLUDE_TESTS}"|^"$(cat ${SRCDIR}/.ci/test_flaky.txt | sed -r '/^(#.*?)?$/d' | paste -sd '~' | sed -r 's/~/\$|^/g' -)"$"
if [[ -n ${EXCLUDE_TESTS} ]]; then
EXCLUDE_TESTS=${EXCLUDE_TESTS}"|"
fi
EXCLUDE_TESTS=${EXCLUDE_TESTS}"^"$(cat ${SRCDIR}/.ci/test_flaky.txt | sed -r '/^(#.*?)?$/d' | paste -sd '~' | sed -r 's/~/\$|^/g' -)"$"
else
echo "Flaky tests are run!"
fi

View File

@ -1,4 +1,4 @@
ARG DISTRO_VERSION=39
ARG DISTRO_VERSION=41
FROM fedora:${DISTRO_VERSION} AS binary-for-oracle
LABEL org.opencontainers.image.authors="Matthias Kuhn <matthias@opengis.ch>"
@ -90,7 +90,9 @@ RUN dnf -y --refresh install \
kernel-devel \
ninja-build \
patch \
dos2unix
dos2unix \
SFCGAL-devel \
blend2d-devel
# Oracle : client side

View File

@ -1,6 +1,5 @@
ARG DISTRO_VERSION=24.10
ARG PDAL_VERSION=2.8.4
ARG DISTRO_VERSION=25.04
# Oracle Docker image is too large, so we add as less dependencies as possible
# so there is enough space on GitHub runner
@ -9,8 +8,6 @@ LABEL org.opencontainers.image.authors="Denis Rouzaud <denis@opengis.ch>"
LABEL Description="Docker container with QGIS dependencies" Vendor="QGIS.org" Version="1.0"
ARG PDAL_VERSION
# && echo "deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main" >> /etc/apt/sources.list \
# && echo "deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main" >> /etc/apt/sources.list \
# && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314DF160 \
@ -32,61 +29,71 @@ RUN apt-get update \
graphviz \
'libaio1|libaio1t64' \
'libdraco4|libdraco8' \
libexiv2-27 \
libexiv2-28 \
'libfcgi0ldbl|libfcgi0t64' \
libgsl28 \
'libprotobuf-lite17|libprotobuf-lite23|libprotobuf-lite32t64' \
libqca-qt5-2-plugins \
libqt53dextras5 \
libqt53drender5 \
'libqt5concurrent5|libqt5concurrent5t64' \
libqt5keychain1 \
libqt5positioning5 \
libqt5multimedia5 \
libqt5multimediawidgets5 \
libqt5qml5 \
libqt5quick5 \
libqt5quickcontrols2-5 \
libqt5quickwidgets5 \
libqt5serialport5 \
libqt5sql5-odbc \
libqt5sql5-sqlite \
'libqt5xml5|libqt5xml5t64' \
libqt5webkit5 \
libqwt-qt5-6 \
libspatialindex7 \
libqca-qt6-plugins \
libqt63dextras6 \
libqt63drender6 \
libqt6concurrent6 \
libqt6keychain1 \
libqt6positioning6 \
libqt6multimedia6 \
libqt6multimediawidgets6 \
libqt6qml6 \
libqt6quick6 \
libqt6quickcontrols2-6 \
libqt6quickwidgets6 \
libqt6serialport6 \
libqt6sql6-odbc \
libqt6sql6-sqlite \
libqt6uitools6 \
libqt6xml6 \
libqt6pdf6 \
libqt6webengine6-data \
libqt6webenginecore6 \
libqt6webenginecore6-bin \
libqt6webenginewidgets6 \
libsqlite3-mod-spatialite \
'libzip4|libzip5|libzip4t64' \
lighttpd \
locales \
poppler-utils \
python3-future \
pyqt6-dev \
pyqt6-dev-tools \
python3-gdal \
python3-mock \
python3-nose2 \
python3-numpy \
python3-oauthlib \
python3-openssl \
python3-owslib \
python3-pep8 \
python3-pexpect \
python3-pip \
python3-psycopg2 \
python3-pyproj \
python3-pyqt5 \
python3-pyqt5.qsci \
python3-pyqt5.qtsql \
python3-pyqt5.qtsvg \
python3-pyqt5.qtwebkit \
python3-pyqt5.qtpositioning \
python3-pyqt5.qtmultimedia \
python3-pyqt5.qtserialport \
python3-sip \
python3-pyqt6 \
python3-pyqt6.qsci \
python3-pyqt6.qtsvg \
python3-pyqt6.qtpositioning \
python3-pyqt6.qtmultimedia \
python3-pyqt6.qtserialport \
python3-pyqt6.qtwebengine \
python3-requests \
python3-shapely \
python3-sphinx \
python3-six \
python3-termcolor \
python3-yaml \
qpdf \
qt3d-assimpsceneimport-plugin \
qt3d-defaultgeometryloader-plugin \
qt3d-gltfsceneio-plugin \
qt3d-scene2d-plugin \
qt5-image-formats-plugins \
saga \
qt6-3d-assimpsceneimport-plugin \
qt6-3d-defaultgeometryloader-plugin \
qt6-3d-gltfsceneio-plugin \
qt6-3d-scene2d-plugin \
qt6-image-formats-plugins \
libsfcgal2 \
supervisor \
unzip \
xauth \
@ -95,25 +102,12 @@ RUN apt-get update \
xfonts-base \
xfonts-scalable \
xvfb \
ocl-icd-libopencl1 \
&& pip3 install --break-system-packages \
numpy \
nose2 \
pyyaml \
mock \
ocl-icd-libopencl1
RUN pip3 install --break-system-packages \
future \
termcolor \
oauthlib \
pyopenssl \
pep8 \
pexpect \
capturer \
sphinx \
requests \
six \
hdbcli \
shapely \
&& apt-get clean
hdbcli
RUN apt-get clean
# Node.js and Yarn for server landingpage webapp
RUN mkdir -p /etc/apt/keyrings
@ -144,25 +138,24 @@ RUN locale-gen
RUN echo "alias python=python3" >> ~/.bash_aliases
# PDAL is not available in ubuntu 24.04
# Install it from source
# PDAL dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
ninja-build \
libgdal-dev \
libproj-dev
# download PDAL and compile it
RUN curl -L https://github.com/PDAL/PDAL/releases/download/${PDAL_VERSION}/PDAL-${PDAL_VERSION}-src.tar.gz --output PDAL-${PDAL_VERSION}-src.tar.gz \
&& mkdir pdal \
&& tar zxf PDAL-${PDAL_VERSION}-src.tar.gz -C pdal --strip-components=1 \
&& rm -f PDAL-${PDAL_VERSION}-src.tar.gz \
&& mkdir -p pdal/build \
&& cd pdal/build \
&& cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_TESTS=OFF .. \
# download spatialindex and compile it
RUN curl -L https://github.com/libspatialindex/libspatialindex/releases/download/2.0.0/spatialindex-src-2.0.0.tar.gz --output spatialindex-src-2.0.0.tar.gz \
&& mkdir spatialindex \
&& tar zxf spatialindex-src-2.0.0.tar.gz -C spatialindex --strip-components=1 \
&& rm -f spatialindex-src-2.0.0.tar.gz \
&& mkdir -p spatialindex/build \
&& cd spatialindex/build \
&& cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local .. \
&& ninja \
&& ninja install
RUN
FROM binary-for-oracle AS binary-only
RUN apt-get update \
@ -186,9 +179,9 @@ RUN curl -j -k -L -H "Cookie: eula_3_2_agreed=tools.hana.ondemand.com/developer-
ENV PATH="/usr/sap/hdbclient:${PATH}"
# MSSQL: client side
RUN curl -sSL -O https://packages.microsoft.com/config/ubuntu/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2)/packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN rm packages-microsoft-prod.deb
RUN curl -sSL -O https://packages.microsoft.com/ubuntu/24.10/prod/pool/main/p/packages-microsoft-prod/packages-microsoft-prod_1.1-ubuntu24.10_all.deb
RUN dpkg -i packages-microsoft-prod_1.1-ubuntu24.10_all.deb
RUN rm packages-microsoft-prod_1.1-ubuntu24.10_all.deb
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y --allow-unauthenticated msodbcsql18 mssql-tools18
ENV PATH="/opt/mssql-tools18/bin:${PATH}"
@ -202,6 +195,7 @@ RUN apt-get update \
clang \
cmake \
flex \
mold \
grass-dev \
libdraco-dev \
libexiv2-dev \
@ -211,35 +205,38 @@ RUN apt-get update \
libgsl-dev \
libpq-dev \
libprotobuf-dev \
libqca-qt5-2-dev \
libqt5opengl5-dev \
libqt5scintilla2-dev \
libqt5svg5-dev \
libqt5webkit5-dev \
libqt5serialport5-dev \
libqwt-qt5-dev \
libspatialindex-dev \
libqca-qt6-dev \
libqt6opengl6-dev \
libqscintilla2-qt6-dev \
libqt6svg6-dev \
libspatialite-dev \
libsqlite3-dev \
libsqlite3-mod-spatialite \
libzip-dev \
libzstd-dev \
protobuf-compiler \
pyqt5-dev \
pyqt5-dev-tools \
pyqt5.qsci-dev \
pyqt6.qsci-dev \
python3-pyqt6.sip \
python3-all-dev \
python3-dev \
python3-sip-dev \
qt3d5-dev \
qt5keychain-dev \
qtbase5-dev \
qtdeclarative5-dev-tools \
qtpositioning5-dev \
qtmultimedia5-dev \
qttools5-dev \
qttools5-dev-tools \
qtbase5-private-dev \
python3-sipbuild \
python3-pyqtbuild \
libsfcgal-dev \
sip-tools \
qmake6 \
qt6-3d-dev \
qtkeychain-qt6-dev \
qt6-base-dev \
qt6-declarative-dev-tools \
qt6-positioning-dev \
qt6-multimedia-dev \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-base-private-dev \
qt6-5compat-dev \
qt6-webengine-dev \
qt6-pdf-dev \
qt6-serialport-dev \
opencl-headers \
ocl-icd-opencl-dev \
&& apt-get clean

View File

@ -35,7 +35,7 @@ jobs:
- ${{ github.workspace }}:/w
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
# To be removed
# Workaround a bug where the initial /etc/dnf/dnf.conf file contains

View File

@ -30,10 +30,10 @@ jobs:
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: 🐩 Install CMake and Ninja
uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # latest
uses: lukka/get-cmake@2ecc21724e5215b0e567bc399a2602d2ecb48541 # latest
with:
# Pin to specific version to avoid rebuilding too often
# Also helps to avoid spurious build failures like https://github.com/qgis/QGIS/pull/47098
@ -89,8 +89,7 @@ jobs:
-B build \
-D QGIS_APP_NAME="QGIS-${{steps.workflow-artifact-ids.outputs.display-name}}" \
-D WITH_VCPKG=ON \
-D BUILD_WITH_QT6=ON \
-D WITH_QTWEBKIT=OFF \
-D WITH_QTWEBENGINE=OFF \
-D WITH_BINDINGS=ON \
-D WITH_ORACLE=ON \
-D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \
@ -151,7 +150,7 @@ jobs:
needs: build
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: 🔨 Prepare build env
run: |

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Get version details
run: |

View File

@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install Requirements
run: |
sudo apt install -y \
@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install Requirements
run: |
sudo apt install -y \
@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Run Banned Keywords Test
run: ./tests/code_layout/test_banned_keywords.sh
@ -83,7 +83,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Run class naming conventions check
run: ./tests/code_layout/test_class_names.sh
@ -91,7 +91,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Def Window Title Test
run: ./tests/code_layout/test_defwindowtitle.sh
@ -99,7 +99,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Run QgsScrollArea check
run: ./tests/code_layout/test_qgsscrollarea.sh
@ -107,7 +107,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: No brace initialization of QVariant variables
run: ./tests/code_layout/test_qvariant_no_brace_init.sh
@ -115,7 +115,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: No module-wide imports of Qt modules
run: ./tests/code_layout/test_qt_imports.sh
@ -123,7 +123,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install Requirements
run: |
sudo apt install -y \
@ -137,7 +137,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 100
- name: Install Requirements
@ -153,7 +153,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install Requirements
run: |
@ -185,7 +185,7 @@ jobs:
python -m pip install --upgrade pip
pip install autopep8 nose2 mock termcolor pyyaml
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Sip Checks
run: ./tests/code_layout/sipify/test_sipify.sh
- name: Sip Include Test
@ -197,7 +197,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install Requirements
run: |
@ -210,7 +210,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:

View File

@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Restore build cache
uses: actions/cache/restore@v4

View File

@ -19,7 +19,7 @@ jobs:
issues: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 200

View File

@ -42,18 +42,18 @@ jobs:
strategy:
matrix:
include:
- distro-version: '24.10'
qt-version: 5
- distro: ubuntu
distro-version: '25.04'
qt-version: 6
run-tests: true
with-qt6: OFF
with-qt5: ON
with-3d: ON
with-quick: ON
with-clazy: ON
with-grass7: OFF
with-grass8: OFF
with-webengine: OFF
with-pdf4qt: OFF
with-pdal: OFF
with-sfcgal: ON
with-compile-commands: ON
with-model-test: ON
with-pg-test: ON
@ -66,18 +66,18 @@ jobs:
experimental: false
unity-builds: ON
- distro-version: '39'
- distro: fedora
distro-version: '42'
qt-version: 6
run-tests: true
with-qt6: ON
with-qt5: OFF
with-3d: ON
with-quick: ON
with-clazy: OFF
with-grass7: OFF
with-grass8: ON
with-webengine: ON
with-pdal: ON
with-pdf4qt: ON
with-sfcgal: ON
with-compile-commands: OFF
with-model-test: OFF
with-pg-test: OFF
@ -90,7 +90,6 @@ jobs:
experimental: false
unity-builds: ON
fail-fast: false
outputs:
@ -110,7 +109,7 @@ jobs:
swap-storage: true
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set vars
env:
@ -143,8 +142,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: .docker/qgis3-qt${{ matrix.qt-version }}-build-deps.dockerfile
tags: qgis/qgis3-build-deps-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}:${{ github.event.pull_request.base.ref || github.ref_name }}
file: .docker/qgis3-${{ matrix.distro }}-qt${{ matrix.qt-version }}-build-deps.dockerfile
tags: qgis/qgis3-build-deps-${{ matrix.distro }}-qt${{ matrix.qt-version }}:${{ github.event.pull_request.base.ref || github.ref_name }}
push: ${{ github.event_name == 'push' && github.repository == 'qgis/QGIS' }}
pull: true
build-args:
@ -157,9 +156,9 @@ jobs:
uses: actions/cache/restore@v4
with:
path: /home/runner/QGIS/.ccache
key: build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-${{ github.event.pull_request.base.ref || github.ref_name }}
key: build-ccache-${{ matrix.distro }}-qt${{ matrix.qt-version }}-${{ github.event.pull_request.base.ref || github.ref_name }}
restore-keys: |
build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-master
build-ccache-${{ matrix.distro }}-qt${{ matrix.qt-version }}-master
- name: Compile QGIS
id: compile
@ -170,16 +169,15 @@ jobs:
--env-file .docker/docker-variables.env \
--env CCACHE_DIR=/root/.ccache \
--env PUSH_TO_CDASH=true \
--env WITH_QT5=${{ matrix.with-qt5 }} \
--env BUILD_WITH_QT6=${{ matrix.with-qt6 }} \
--env WITH_QUICK=${{ matrix.with-quick }} \
--env WITH_3D=${{ matrix.with-3d }} \
--env WITH_GRASS7=${{ matrix.with-grass7 }} \
--env WITH_GRASS8=${{ matrix.with-grass8 }} \
--env WITH_QTWEBENGINE=${{ matrix.with-webengine }} \
--env WITH_PDF4QT=${{ matrix.with-pdf4qt }} \
--env WITH_PDAL=${{ matrix.with-pdal }} \
--env LD_PRELOAD=${{ matrix.LD_PRELOAD }} \
--env WITH_CLAZY=${{ matrix.with-clazy }} \
--env WITH_SFCGAL=${{ matrix.with-sfcgal }} \
--env WITH_COMPILE_COMMANDS=${{ matrix.with-compile-commands }} \
--env ENABLE_UNITY_BUILDS=${{ matrix.unity-builds }} \
--env WITH_MODEL_TEST=${{ matrix.with-model-test }} \
@ -197,7 +195,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
with:
path: /home/runner/QGIS/.ccache
key: build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-${{ github.ref_name }}-${{ github.run_id }}
key: build-ccache-${{ matrix.distro }}-qt${{ matrix.qt-version }}-${{ github.ref_name }}-${{ github.run_id }}
- name: Push artifact
id: push_artifact
@ -207,7 +205,7 @@ jobs:
- uses: actions/upload-artifact@v4
if: ${{ matrix.run-tests }}
with:
name: build-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}.tgz
name: build-${{ matrix.distro }}-qt${{ matrix.qt-version }}.tgz
path: ./build.tgz
retention-days: 1
@ -263,32 +261,49 @@ jobs:
strategy:
matrix:
qt-version: [5, 6]
test-batch: [ALL_BUT_PROVIDERS, POSTGRES, HANA, SQLSERVER]
include:
- qt-version: 5
distro-version: '24.10'
- qt-version: 6
distro: ubuntu
distro-version: '25.04'
docker-target: binary-only
test-blocklist-file: .ci/test_blocklist_qt6_ubuntu.txt
test-batch: ALL_BUT_PROVIDERS
- qt-version: 6
distro-version: 39
distro: fedora
distro-version: '42'
docker-target: binary-only
- qt-version: 5
distro-version: '24.10'
test-batch: ORACLE
docker-target: binary-for-oracle
exclude:
- qt-version: 6
test-batch: HANA
test-blocklist-file: .ci/test_blocklist_qt6_fedora.txt
test-batch: ALL_BUT_PROVIDERS
- qt-version: 6
distro: ubuntu
distro-version: '25.04'
test-batch: POSTGRES
test-blocklist-file: .ci/test_blocklist_qt6_ubuntu.txt
docker-target: binary-only
- qt-version: 6
distro: ubuntu
distro-version: '25.04'
test-batch: HANA
test-blocklist-file: .ci/test_blocklist_qt6_ubuntu.txt
docker-target: binary-only
- qt-version: 6
distro: ubuntu
distro-version: '25.04'
test-batch: SQLSERVER
test-blocklist-file: .ci/test_blocklist_qt6_ubuntu.txt
docker-target: binary-only
- qt-version: 6
distro: ubuntu
distro-version: '25.04'
test-batch: ORACLE
test-blocklist-file: .ci/test_blocklist_qt6_ubuntu.txt
docker-target: binary-for-oracle
fail-fast: false
@ -303,7 +318,7 @@ jobs:
swap-storage: true
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set vars
env:
@ -332,8 +347,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: .docker/qgis3-qt${{ matrix.qt-version }}-build-deps.dockerfile
tags: qgis/qgis3-qt${{ matrix.qt-version }}-build-deps-bin-only:${{ github.event.pull_request.base.ref || github.ref_name }}
file: .docker/qgis3-${{ matrix.distro }}-qt${{ matrix.qt-version }}-build-deps.dockerfile
tags: qgis/qgis3-${{ matrix.distro }}-qt${{ matrix.qt-version }}-build-deps-bin-only:${{ github.event.pull_request.base.ref || github.ref_name }}
push: ${{ github.event_name == 'push' && github.repository == 'qgis/QGIS' }}
pull: true
target: ${{ matrix.docker-target }}
@ -353,7 +368,7 @@ jobs:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}.tgz
name: build-${{ matrix.distro }}-qt${{ matrix.qt-version }}.tgz
path: .
- name: Extract build artifact
@ -372,6 +387,7 @@ jobs:
TEST_BATCH: ${{matrix.test-batch}}
QGIS_COMMON_GIT_DIR: ${{ github.workspace }}
GITHUB_SHA: ${{ github.sha }}
TEST_BLOCKLIST_FILE: ${{matrix.test-blocklist-file}}
run: |
DOCKERFILE=$( ( [[ ${{ matrix.test-batch }} == "ORACLE" ]] && echo "docker-compose-testing-oracle.yml" ) \
|| ( [[ ${{ matrix.test-batch }} == "POSTGRES" ]] && echo "docker-compose-testing-postgres.yml" ) \
@ -380,9 +396,10 @@ jobs:
[[ ${{ matrix.test-batch }} == "ORACLE" ]] && sudo rm -rf /usr/share/dotnet/sdk
echo "TEST_BATCH=$TEST_BATCH"
echo "DOCKERFILE=$DOCKERFILE"
echo "TEST_BLOCKLIST_FILE=$TEST_BLOCKLIST_FILE"
mkdir -p /tmp/webdav_tests && chmod 777 /tmp/webdav_tests
mkdir -p /tmp/minio_tests/test-bucket && chmod -R 777 /tmp/minio_tests
docker compose -f .docker/$DOCKERFILE run -e GITHUB_SHA=$GITHUB_SHA qgis-deps /root/QGIS/.docker/docker-qgis-test.sh $TEST_BATCH
docker compose -f .docker/$DOCKERFILE run -e GITHUB_SHA=$GITHUB_SHA qgis-deps /root/QGIS/.docker/docker-qgis-test.sh $TEST_BATCH $TEST_BLOCKLIST_FILE
- name: Fix permissions on test report
if: ${{ failure() }}
@ -404,7 +421,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-results-qt${{ matrix.qt-version }}
name: test-results-${{ matrix.distro }}-qt${{ matrix.qt-version }}-${{ matrix.test-batch }}
path: qgis_test_report
clang-tidy:
@ -415,8 +432,9 @@ jobs:
strategy:
matrix:
include:
- distro-version: '24.10'
qt-version: 5
- distro: ubuntu
distro-version: '25.04'
qt-version: 6
steps:
- name: Free Disk Space (Ubuntu)
@ -428,7 +446,7 @@ jobs:
swap-storage: true
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 2
@ -444,8 +462,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: .docker/qgis3-qt${{ matrix.qt-version }}-build-deps.dockerfile
tags: qgis/qgis3-qt${{ matrix.qt-version }}-build-deps-bin-only:${{ github.event.pull_request.base.ref || github.ref_name }}
file: .docker/qgis3-${{ matrix.distro }}-qt${{ matrix.qt-version }}-build-deps.dockerfile
tags: qgis/qgis3-${{ matrix.distro }}-qt${{ matrix.qt-version }}-build-deps-bin-only:${{ github.event.pull_request.base.ref || github.ref_name }}
push: ${{ github.event_name == 'push' && github.repository == 'qgis/QGIS' }}
pull: true
target: ${{ matrix.docker-target }}
@ -458,7 +476,7 @@ jobs:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}.tgz
name: build-${{ matrix.distro }}-qt${{ matrix.qt-version }}.tgz
path: .
- name: Extract build artifact

View File

@ -24,7 +24,7 @@ jobs:
if: ${{ github.event_name == 'issue_comment' }}
id: comment-branch
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: run sipify
run: ./scripts/sipify_all.sh -m

View File

@ -13,7 +13,7 @@ jobs:
vcpkg-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 30

View File

@ -23,7 +23,7 @@ jobs:
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 2
@ -33,7 +33,7 @@ jobs:
choco uninstall cmake.install
- name: 🐩 Install CMake and Ninja
uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8
uses: lukka/get-cmake@2ecc21724e5215b0e567bc399a2602d2ecb48541
with:
cmakeVersion: 3.31.6
@ -84,13 +84,12 @@ jobs:
-D WITH_3D=ON \
-D WITH_BINDINGS=ON \
-D ENABLE_TESTS=OFF \
-D BUILD_WITH_QT6=ON \
-D USE_CCACHE=ON \
-D ENABLE_UNITY_BUILDS=ON \
-D FLEX_EXECUTABLE="${SOURCE_DIR}/win_flex.exe" \
-D BISON_EXECUTABLE="${SOURCE_DIR}/win_bison.exe" \
-D USE_CCACHE=ON \
-D WITH_QTWEBKIT=OFF \
-D WITH_QTWEBENGINE=OFF \
-D VCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:/src" \
-D NUGET_USERNAME=${{ github.actor }} \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }}

View File

@ -14,6 +14,8 @@ jobs:
strategy:
matrix:
qt-version: [ 5, 6 ]
distro: ['fedora', 'ubuntu']
test-batch: ['ALL_BUT_PROVIDERS', 'POSTGRES', 'HANA', 'SQLSERVER', 'ORACLE']
permissions:
pull-requests: write
@ -31,7 +33,7 @@ jobs:
run_id: context.payload.workflow_run.id,
});
let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "test-results-qt${{ matrix.qt-version }}"
return artifact.name == "test-results-${{ matrix.distro }}-qt${{ matrix.qt-version }}-${{ matrix.test-batch }}"
});
if (matchArtifacts.length>0)
{
@ -42,7 +44,7 @@ jobs:
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/test-results-qt${{ matrix.qt-version }}.zip`, Buffer.from(download.data));
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/test-results-${{ matrix.distro }}-qt${{ matrix.qt-version }}-${{ matrix.test-batch }}.zip`, Buffer.from(download.data));
core.setOutput('artifact_id', matchArtifacts[0].id);
}
else
@ -52,7 +54,7 @@ jobs:
- name: 'Unzip artifact'
if: fromJSON(steps.download_artifact.outputs.artifact_id) > 0
run: unzip -j test-results-qt${{ matrix.qt-version }}.zip *.md pr_number git_commit || ( e=$? && if [ $e -ne 11 ]; then exit $e; fi )
run: unzip -j test-results-${{ matrix.distro }}-qt${{ matrix.qt-version }}-${{ matrix.test-batch }}.zip *.md pr_number git_commit || ( e=$? && if [ $e -ne 11 ]; then exit $e; fi )
- name: 'Post test report markdown summary as comment on PR'
if: fromJSON(steps.download_artifact.outputs.artifact_id) > 0
@ -71,7 +73,7 @@ jobs:
issue_number: issue_number,
});
const PREFIX = "# Tests failed for Qt ${{ matrix.qt-version }}";
const PREFIX = "# Tests failed for Qt ${{ matrix.qt-version }} (${{ matrix.test-batch }} - ${{ matrix.distro }})";
let body = PREFIX + "\n\n";
body += "*One or more tests failed using the build from commit " + git_sha + "*\n\n";

View File

@ -17,6 +17,8 @@ endif()
# don't relink it only the shared object changes
set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
set (BUILD_WITH_QT6 TRUE CACHE BOOL "Enable Qt6 support")
option (WITH_PYTHON "Determines whether Python support should be built (disabling it will in particular disable processing)" ON)
set (WITH_BINDINGS ${WITH_PYTHON} CACHE BOOL "Determines whether Python bindings should be built")
@ -75,6 +77,9 @@ set(QGIS_APP_NAME "qgis" CACHE STRING "The main app name and bundle name")
math(EXPR QGIS_VERSION_INT "${CPACK_PACKAGE_VERSION_MAJOR}*10000+${CPACK_PACKAGE_VERSION_MINOR}*100+${CPACK_PACKAGE_VERSION_PATCH}")
message(STATUS "QGIS version: ${COMPLETE_VERSION} ${RELEASE_NAME} (${QGIS_VERSION_INT})")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set (ENABLE_LOCAL_BUILD_SHORTCUTS FALSE CACHE BOOL "Disables some build steps which are only relevant for releases to speed up compilation time for development")
#############################################################
@ -245,6 +250,8 @@ if(WITH_CORE)
endif()
endif()
set (WITH_SFCGAL FALSE CACHE BOOL "Determines whether SFCGAL geometry support should be built")
set (WITH_QUICK FALSE CACHE BOOL "Determines whether QGIS Quick library should be built")
set (NATIVE_CRSSYNC_BIN "" CACHE PATH "Path to a natively compiled synccrsdb binary. If set, crssync will not build but use provided bin instead.")
@ -441,7 +448,16 @@ if(WITH_CORE)
find_package(GDAL REQUIRED)
message(STATUS "Found GDAL: ${GDAL_VERSION} ${GDAL_DIR}")
find_package(EXPAT REQUIRED)
find_package(Spatialindex REQUIRED)
set (WITH_INTERNAL_SPATIALINDEX FALSE CACHE BOOL "Determines whether spatialindex should be built from internal copy")
IF(WITH_INTERNAL_SPATIALINDEX)
message(STATUS "Using internal spatialindex")
set(SPATIALINDEX_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/external/spatialindex/include)
else()
find_package(Spatialindex REQUIRED)
if(SPATIALINDEX_VERSION VERSION_GREATER_EQUAL "2.1")
message(FATAL_ERROR "Cannot build QGIS using libspatialindex >= 2.1, see https://github.com/libspatialindex/libspatialindex/issues/276")
endif()
endif()
find_package(LibZip REQUIRED)
set (WITH_INTERNAL_NLOHMANN_JSON ${PREFER_INTERNAL_LIBS} CACHE BOOL "Determines whether the vendored copy of nlohmann-json should be used")
find_package(nlohmann_json REQUIRED)
@ -465,6 +481,29 @@ if(WITH_CORE)
find_package(EXIV2 REQUIRED)
# optional
if (WITH_SFCGAL)
if(POLICY CMP0167) # avoid deprecation warning from CGAL
cmake_policy(SET CMP0167 NEW)
endif()
find_package(SFCGAL) # SFCGAL provider
message(STATUS "Found SFCGAL: ${SFCGAL_VERSION} ${SFCGAL_DIR}")
string(REGEX REPLACE "^.*([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\1" SFCGAL_VERSION_MAJOR_INT "${SFCGAL_VERSION}")
string(REGEX REPLACE "^.*([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\2" SFCGAL_VERSION_MINOR_INT "${SFCGAL_VERSION}")
string(REGEX REPLACE "^.*([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\3" SFCGAL_VERSION_PATCH_INT "${SFCGAL_VERSION}")
if(SFCGAL_VERSION VERSION_LESS "2.0")
message(FATAL_ERROR "Cannot build QGIS using SFCGAL older than 2.0")
endif()
if (WITH_SFCGAL)
add_definitions(-DWITH_SFCGAL)
message(STATUS "SFCGAL support enabled")
else()
message(STATUS "SFCGAL support DISABLED.")
endif()
endif()
if (WITH_POSTGRESQL)
find_package(Postgres) # PostgreSQL provider
endif()
@ -487,7 +526,7 @@ if(WITH_CORE)
set (HAVE_POSTGRESQL TRUE)
endif()
set (WITH_QTWEBKIT TRUE CACHE BOOL "Enable QtWebkit support")
set (WITH_QTWEBKIT FALSE CACHE BOOL "Enable QtWebkit support")
if (WITH_QTWEBKIT)
add_definitions(-DWITH_QTWEBKIT)
message(STATUS "Qt WebKit support enabled")
@ -534,15 +573,13 @@ if(WITH_CORE)
#############################################################
# search for Qt
set (BUILD_WITH_QT6 FALSE CACHE BOOL "Enable (experimental) Qt6 support")
if (BUILD_WITH_QT6)
set(QT_VERSION_MAJOR 6)
set(QT_MIN_VERSION 6.4.0)
set(QT_VERSION_BASE "Qt6")
set(QT_VERSION_BASE_LOWER "qt6")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
else()
message(WARNING "Qt5 is no longer officially supported -- this build may be broken or buggy!")
set(QT_VERSION_MAJOR 5)
set(QT_MIN_VERSION 5.15.2)
set(QT_VERSION_BASE "Qt5")
@ -570,6 +607,9 @@ if(WITH_CORE)
set (WITH_PDF4QT FALSE CACHE BOOL "Determines whether the embedded PDF4Qt library should be build for PDF and HTML to QPainter conversion")
if (WITH_PDF4QT)
if(NOT BUILD_WITH_QT6)
message(FATAL_ERROR "PDF4Qt requires a Qt 6 build")
endif()
set(HAVE_PDF4QT TRUE) # used in qgisconfig.h
message(STATUS "PDF4Qt enabled")
else()
@ -604,7 +644,7 @@ if(WITH_CORE)
set(HAVE_3D TRUE) # used in qgsconfig.h
endif()
set (WITH_QTWEBENGINE FALSE CACHE BOOL "Enable QtWebEngine support")
set (WITH_QTWEBENGINE TRUE CACHE BOOL "Enable QtWebEngine support")
if (WITH_QTWEBENGINE)
if(BUILD_WITH_QT6)
find_package(${QT_VERSION_BASE} COMPONENTS WebEngineCore REQUIRED)
@ -1178,7 +1218,6 @@ if (WITH_CORE AND WITH_BINDINGS)
include(SIPMacros)
set(SIP_INCLUDES ${PYQT_SIP_DIR} ${CMAKE_SOURCE_DIR}/python)
set(SIP_CONCAT_PARTS 26)
if(BINDINGS_GLOBAL_INSTALL)
set(QGIS_PYTHON_INSTALL_DIR ${Python_SITEARCH})

View File

@ -24,6 +24,7 @@ Building QGIS from source - step by step
+ [3.11.3. Additional tools for QGIS development](#3113-additional-tools-for-qgis-development)
+ [3.11.4. QT6 experimental builds with Fedora Rawhide](#3114-qt6-experimental-builds-with-fedora-rawhide)
* [3.12. Building on Linux with vcpkg](#312-building-on-linux-with-vcpkg)
* [3.13. Building and running with Nix](#313-building-and-running-with-nix)
- [4. Building on Windows](#4-building-on-windows)
* [4.1. Building with Microsoft Visual Studio](#41-building-with-microsoft-visual-studio)
+ [4.1.1. Visual Studio 2022 Community Edition](#411-visual-studio-2022-community-edition)
@ -179,16 +180,12 @@ sudo apt-get update
|Distribution|Install command for packages|
|------------|----------------------------|
| bookworm | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| trixie | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| jammy | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpdal-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pdal pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| kinetic | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| lunar | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| mantic | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| noble | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| oracular | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| plucky | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| sid | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-packaging python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| bookworm | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libmeshoptimizer-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-matplotlib python3-mock python3-nose2 python3-owslib python3-packaging python3-psycopg2 python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt6.sip python3-pyqtbuild python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| trixie | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libmeshoptimizer-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqca-qt6-dev libqca-qt6-plugins libqscintilla2-qt5-dev libqscintilla2-qt6-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5xmlpatterns5-dev libsfcgal-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev pyqt6-dev pyqt6-dev-tools pyqt6.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-matplotlib python3-mock python3-nose2 python3-owslib python3-packaging python3-psycopg2 python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt6 python3-pyqt6.qsci python3-pyqt6.qtmultimedia python3-pyqt6.qtpositioning python3-pyqt6.qtserialport python3-pyqt6.qtsvg python3-pyqt6.sip python3-pyqtbuild python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt6-3d-assimpsceneimport-plugin qt6-3d-defaultgeometryloader-plugin qt6-3d-dev qt6-3d-gltfsceneio-plugin qt6-3d-scene2d-plugin qt6-5compat-dev qt6-base-dev qt6-base-private-dev qt6-multimedia-dev qt6-positioning-dev qt6-serialport-dev qt6-svg-dev qt6-tools-dev qt6-tools-dev-tools qt6-webengine-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtkeychain-qt6-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| noble | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libmeshoptimizer-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-matplotlib python3-mock python3-nose2 python3-owslib python3-packaging python3-psycopg2 python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt6.sip python3-pyqtbuild python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| plucky | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libmeshoptimizer-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqca-qt6-dev libqca-qt6-plugins libqscintilla2-qt5-dev libqscintilla2-qt6-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5xmlpatterns5-dev libsfcgal-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev pyqt6-dev pyqt6-dev-tools pyqt6.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-matplotlib python3-mock python3-nose2 python3-owslib python3-packaging python3-psycopg2 python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt6 python3-pyqt6.qsci python3-pyqt6.qtmultimedia python3-pyqt6.qtpositioning python3-pyqt6.qtserialport python3-pyqt6.qtsvg python3-pyqt6.sip python3-pyqtbuild python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt6-3d-assimpsceneimport-plugin qt6-3d-defaultgeometryloader-plugin qt6-3d-dev qt6-3d-gltfsceneio-plugin qt6-3d-scene2d-plugin qt6-5compat-dev qt6-base-dev qt6-base-private-dev qt6-multimedia-dev qt6-positioning-dev qt6-serialport-dev qt6-svg-dev qt6-tools-dev qt6-tools-dev-tools qt6-webengine-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtkeychain-qt6-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| questing | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libmeshoptimizer-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqca-qt6-dev libqca-qt6-plugins libqscintilla2-qt5-dev libqscintilla2-qt6-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5xmlpatterns5-dev libsfcgal-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev pyqt6-dev pyqt6-dev-tools pyqt6.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-matplotlib python3-mock python3-nose2 python3-owslib python3-packaging python3-psycopg2 python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt6 python3-pyqt6.qsci python3-pyqt6.qtmultimedia python3-pyqt6.qtpositioning python3-pyqt6.qtserialport python3-pyqt6.qtsvg python3-pyqt6.sip python3-pyqtbuild python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt6-3d-assimpsceneimport-plugin qt6-3d-defaultgeometryloader-plugin qt6-3d-dev qt6-3d-gltfsceneio-plugin qt6-3d-scene2d-plugin qt6-5compat-dev qt6-base-dev qt6-base-private-dev qt6-multimedia-dev qt6-positioning-dev qt6-serialport-dev qt6-svg-dev qt6-tools-dev qt6-tools-dev-tools qt6-webengine-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtkeychain-qt6-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| sid | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libmeshoptimizer-dev libpq-dev libproj-dev libprotobuf-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqca-qt6-dev libqca-qt6-plugins libqscintilla2-qt5-dev libqscintilla2-qt6-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5xmlpatterns5-dev libsfcgal-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev libzstd-dev lighttpd locales ninja-build nlohmann-json3-dev ocl-icd-opencl-dev opencl-headers pandoc pkgconf poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev pyqt6-dev pyqt6-dev-tools pyqt6.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-matplotlib python3-mock python3-nose2 python3-owslib python3-packaging python3-psycopg2 python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt6 python3-pyqt6.qsci python3-pyqt6.qtmultimedia python3-pyqt6.qtpositioning python3-pyqt6.qtserialport python3-pyqt6.qtsvg python3-pyqt6.sip python3-pyqtbuild python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt6-3d-assimpsceneimport-plugin qt6-3d-defaultgeometryloader-plugin qt6-3d-dev qt6-3d-gltfsceneio-plugin qt6-3d-scene2d-plugin qt6-5compat-dev qt6-base-dev qt6-base-private-dev qt6-multimedia-dev qt6-positioning-dev qt6-serialport-dev qt6-svg-dev qt6-tools-dev qt6-tools-dev-tools qt6-webengine-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtkeychain-qt6-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
(extracted from the control.in file in `debian/`)
@ -350,7 +347,6 @@ ninja qgis_desktop
QGIS build is tunable according to your needs. Many flags are available to activate or deactivate some functionalities, here is a subset:
* `BUILD_WITH_QT6`: Enable (experimental) Qt6 support
* `WITH_3D`: Determines whether QGIS 3D library should be built
* `WITH_ANALYSIS`: Determines whether QGIS analysis library should be built
* `WITH_AUTH`: Determines whether QGIS authentication methods should be built
@ -562,7 +558,7 @@ are required for the various QGIS source formatting and preparation scripts.
dnf install ag ccache expect ninja-build astyle python3-autopep8 python3-mock python3-nose2 perl-YAML-Tiny
```
### 3.11.4. QT6 experimental builds with Fedora Rawhide
### 3.11.4. QT6 builds with Fedora Rawhide
This requires latest QGIS master (>= January 25th 2024).
@ -583,7 +579,7 @@ Installation of all needed build dependencies:
To build,
```bash
cmake .. -DBUILD_WITH_QT6=ON -DWITH_QTWEBKIT=OFF -DWITH_QTWEBENGINE=ON
cmake ..
```
## 3.12. Building on Linux with vcpkg
@ -607,8 +603,6 @@ cmake -S . \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_VCPKG=ON \
-DBUILD_WITH_QT6=ON \
-DWITH_QTWEBKIT=OFF \
-DWITH_BINDINGS=ON \
-DVCPKG_TARGET_TRIPLET=x64-linux-dynamic-release \
-DVCPKG_HOST_TRIPLET=x64-linux-dynamic-release
@ -620,6 +614,38 @@ Build:
cmake --build ./build-x64-linux
```
## 3.13. Building and running with Nix
With [Nix](https://nixos.org/) and [Nixpkgs](https://github.com/NixOS/nixpkgs)
you can build and run any QGIS version directly from Git using a single command.
First, install Nix
[(learn more about this installer)](https://zero-to-nix.com/start/install)
```bash
curl --proto '=https' --tlsv1.2 -sSf \
-L https://install.determinate.systems/nix \
| sh -s -- install
```
Then, run one of the following commands to automatically build and run QGIS.
Run QGIS from Git:
```sh
nix run github:qgis/QGIS#qgis # run latest version from master
nix run github:qgis/QGIS/<BRANCH>#qgis # run latest version from specific branch
nix run github:qgis/QGIS/<CHECKOUT>#qgis # run latest version from specific checkout
```
Run QGIS from PR:
```sh
nix run github:qgis/QGIS/pull/<PR-NUMBER>/merge#qgis
```
# 4. Building on Windows
## 4.1. Building with Microsoft Visual Studio
@ -820,8 +846,6 @@ Open a _Developer PowerShell for VS 2022_
cmake -S . `
-B build `
-DSDK_PATH="path/to/vcpkg-export-[date]" `
-DBUILD_WITH_QT6=ON `
-DWITH_QTWEBKIT=OFF `
-DVCPKG_TARGET_TRIPLET=x64-windows-release `
-DFLEX_EXECUTABLE="path/to/flex-executable" `
-DBISON_EXECUTABLE="path/to/bison-executable"
@ -852,8 +876,6 @@ This will require some time, cpu and disk space.
cmake -S . `
-B build `
-D WITH_VCPKG=ON `
-D BUILD_WITH_QT6=ON `
-D WITH_QTWEBKIT=OFF `
-D VCPKG_TARGET_TRIPLET=x64-windows-release `
-D VCPKG_HOST_TRIPLET=x64-windows-release
```
@ -1084,8 +1106,6 @@ cmake -S . \
-G Ninja \
-B build \
-D WITH_VCPKG=ON \
-D BUILD_WITH_QT6=ON \
-D WITH_QTWEBKIT=OFF \
-D WITH_BINDINGS=ON \
-D VCPKG_TARGET_TRIPLET="$TRIPLET" \
-D VCPKG_HOST_TRIPLET="$TRIPLET"

175
cmake/FindSFCGAL.cmake Normal file
View File

@ -0,0 +1,175 @@
# Find SFCGAL
# ~~~~~~~~~
# Copyright (c) 2024, De Mezzo Benoit <benoit dot de dot mezzo at oslandia dot com>
# Copyright (c) 2024, Felder Jean <jean dot felder at oslandia dot com>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# SFCGAL_DIR variable can be set to define a custom sfcgal installation path
#
# Once run this will define:
#
# SFCGAL_FOUND = system has SFCGAL lib
#
# SFCGAL_LIBRARY = full path to the library
#
# SFCGAL_INCLUDE_DIR = where to find headers
IF (NOT SFCGAL_INCLUDE_DIR OR NOT SFCGAL_LIBRARY)
IF(WIN32)
IF (MINGW)
FIND_PATH(SFCGAL_INCLUDE_DIR
SFCGAL/capi/sfcgal_c.h
/usr/local/include
/usr/include
c:/msys/local/include
${SFCGAL_DIR}/include
PATH_SUFFIXES sfcgal
)
FIND_LIBRARY(SFCGAL_LIBRARY NAMES SFCGAL
PATHS
/usr/local/lib
/usr/lib
c:/msys/local/lib
${SFCGAL_DIR}/lib
)
ENDIF (MINGW)
IF (MSVC)
FIND_PATH(SFCGAL_INCLUDE_DIR
SFCGAL/capi/sfcgal_c.h
"$ENV{LIB_DIR}/include"
$ENV{INCLUDE}
${SFCGAL_DIR}/include
)
FIND_LIBRARY(SFCGAL_LIBRARY NAMES SFCGAL SFCGAL_i
PATHS
"$ENV{LIB_DIR}/lib"
$ENV{LIB}
/usr/lib
c:/msys/local/lib
${SFCGAL_DIR}/lib
)
ENDIF (MSVC)
ELSEIF(APPLE AND QGIS_MAC_DEPS_DIR)
FIND_PATH(SFCGAL_INCLUDE_DIR
SFCGAL/capi/sfcgal_c.h
"$ENV{LIB_DIR}/include"
${SFCGAL_DIR}/include
)
FIND_LIBRARY(SFCGAL_LIBRARY NAMES SFCGAL
PATHS
"$ENV{LIB_DIR}/lib"
${SFCGAL_DIR}/include
)
ELSE(WIN32)
# try to use framework on mac
# want clean framework path, not unix compatibility path
IF (APPLE)
IF (CMAKE_FIND_FRAMEWORK MATCHES "FIRST"
OR CMAKE_FRAMEWORK_PATH MATCHES "ONLY"
OR NOT CMAKE_FIND_FRAMEWORK)
SET (CMAKE_FIND_FRAMEWORK_save ${CMAKE_FIND_FRAMEWORK} CACHE STRING "" FORCE)
SET (CMAKE_FIND_FRAMEWORK "ONLY" CACHE STRING "" FORCE)
FIND_LIBRARY(SFCGAL_LIBRARY SFCGAL)
IF (SFCGAL_LIBRARY)
# they're all the same in a framework
SET (SFCGAL_INCLUDE_DIR ${SFCGAL_LIBRARY}/Headers CACHE PATH "Path to a file.")
# set SFCGAL_CONFIG to make later test happy, not used here, may not exist
SET (SFCGAL_CONFIG ${SFCGAL_LIBRARY}/unix/bin/sfcgal-config CACHE FILEPATH "Path to a program.")
# version in info.plist
GET_VERSION_PLIST (${SFCGAL_LIBRARY}/Resources/Info.plist SFCGAL_VERSION)
ENDIF (SFCGAL_LIBRARY)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
ENDIF ()
ENDIF (APPLE)
IF(CYGWIN)
FIND_LIBRARY(SFCGAL_LIBRARY NAMES SFCGAL
PATHS
/usr/lib
/usr/local/lib
${SFCGAL_DIR}/lib
)
ENDIF(CYGWIN)
# SFCGAL_INCLUDE_DIR or SFCGAL_LIBRARY has not been found, try to set SFCGAL_CONFIG
IF (NOT SFCGAL_INCLUDE_DIR OR NOT SFCGAL_LIBRARY)
SET(SFCGAL_CONFIG_PREFER_PATH "$ENV{SFCGAL_HOME}/bin" CACHE STRING "preferred path to SFCGAL (sfcgal-config)")
FIND_PROGRAM(SFCGAL_CONFIG sfcgal-config
${SFCGAL_CONFIG_PREFER_PATH}
${SFCGAL_DIR}/bin
$ENV{LIB_DIR}/bin
/usr/local/bin/
/usr/bin/
)
ENDIF (NOT SFCGAL_INCLUDE_DIR OR NOT SFCGAL_LIBRARY)
ENDIF(WIN32)
ENDIF (NOT SFCGAL_INCLUDE_DIR OR NOT SFCGAL_LIBRARY)
IF (SFCGAL_CONFIG)
# set INCLUDE_DIR to prefix+include
execute_process(COMMAND ${SFCGAL_CONFIG} --prefix
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE SFCGAL_PREFIX)
FIND_PATH(SFCGAL_INCLUDE_DIR
SFCGAL/capi/sfcgal_c.h
${SFCGAL_PREFIX}/include
/usr/local/include
/usr/include
)
## extract link dirs for rpath
execute_process(COMMAND ${SFCGAL_CONFIG} --libs
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE SFCGAL_CONFIG_LIBS )
## split off the link dirs (for rpath)
## use regular expression to match wildcard equivalent "-L*<endchar>"
## with <endchar> is a space or a semicolon
STRING(REGEX MATCHALL "[-][L]([^ ;])+"
SFCGAL_LINK_DIRECTORIES_WITH_PREFIX
"${SFCGAL_CONFIG_LIBS}" )
IF (SFCGAL_LINK_DIRECTORIES_WITH_PREFIX)
STRING(REGEX REPLACE "[-][L]" "" SFCGAL_LINK_DIRECTORIES ${SFCGAL_LINK_DIRECTORIES_WITH_PREFIX} )
ENDIF (SFCGAL_LINK_DIRECTORIES_WITH_PREFIX)
FIND_LIBRARY(SFCGAL_LIBRARY NAMES SFCGAL libSFCGAL SFCGALd libSFCGALd
PATHS
${SFCGAL_LINK_DIRECTORIES}/lib
${SFCGAL_LINK_DIRECTORIES}
)
ENDIF (SFCGAL_CONFIG)
IF (SFCGAL_INCLUDE_DIR AND SFCGAL_LIBRARY)
SET(SFCGAL_FOUND TRUE)
ENDIF (SFCGAL_INCLUDE_DIR AND SFCGAL_LIBRARY)
IF (SFCGAL_FOUND)
IF (NOT SFCGAL_FIND_QUIETLY)
FILE(READ ${SFCGAL_INCLUDE_DIR}/SFCGAL/version.h sfcgal_version)
STRING(REGEX REPLACE "^.*SFCGAL_VERSION +\"([^\"]+)\".*$" "\\1" SFCGAL_VERSION "${sfcgal_version}")
MESSAGE(STATUS "Found SFCGAL: ${SFCGAL_LIBRARY} (${SFCGAL_VERSION})")
ENDIF (NOT SFCGAL_FIND_QUIETLY)
add_library(SFCGAL::SFCGAL UNKNOWN IMPORTED)
target_link_libraries(SFCGAL::SFCGAL INTERFACE ${SFCGAL_LIBRARY})
target_include_directories(SFCGAL::SFCGAL INTERFACE ${SFCGAL_INCLUDE_DIR})
set_target_properties(SFCGAL::SFCGAL PROPERTIES IMPORTED_LOCATION ${SFCGAL_LIBRARY})
ELSE (SFCGAL_FOUND)
MESSAGE(SFCGAL_INCLUDE_DIR=${SFCGAL_INCLUDE_DIR})
MESSAGE(SFCGAL_LIBRARY=${SFCGAL_LIBRARY})
MESSAGE(FATAL_ERROR "Could not find SFCGAL")
ENDIF (SFCGAL_FOUND)

View File

@ -8,7 +8,7 @@
# SPATIALINDEX_FOUND = system has Spatialindex lib
# SPATIALINDEX_LIBRARY = full path to the Spatialindex library
# SPATIALINDEX_INCLUDE_DIR = where to find headers
#
# SPATIALINDEX_VERSION = version number
FIND_PATH(SPATIALINDEX_INCLUDE_DIR spatialindex/SpatialIndex.h PATHS
@ -32,8 +32,21 @@ IF (SPATIALINDEX_INCLUDE_DIR AND SPATIALINDEX_LIBRARY)
ENDIF (SPATIALINDEX_INCLUDE_DIR AND SPATIALINDEX_LIBRARY)
IF (SPATIALINDEX_FOUND)
set(spatialindex_version_file
"${SPATIALINDEX_INCLUDE_DIR}/spatialindex/Version.h")
file(STRINGS "${spatialindex_version_file}" spatialindex_version_major REGEX "#define SIDX_VERSION_MAJOR")
list(GET spatialindex_version_major 0 spatialindex_version_major)
string(REGEX MATCH "[0-9]+" SPATIALINDEX_VERSION_MAJOR ${spatialindex_version_major} )
file(STRINGS "${spatialindex_version_file}" spatialindex_version_minor REGEX "#define SIDX_VERSION_MINOR")
list(GET spatialindex_version_minor 0 spatialindex_version_minor)
string(REGEX MATCH "[0-9]+" SPATIALINDEX_VERSION_MINOR ${spatialindex_version_minor} )
file(STRINGS "${spatialindex_version_file}" spatialindex_version_rev REGEX "#define SIDX_VERSION_REV")
list(GET spatialindex_version_rev 0 spatialindex_version_rev)
string(REGEX MATCH "[0-9]+" SPATIALINDEX_VERSION_REV ${spatialindex_version_rev} )
set(SPATIALINDEX_VERSION "${SPATIALINDEX_VERSION_MAJOR}.${SPATIALINDEX_VERSION_MINOR}.${SPATIALINDEX_VERSION_REV}")
IF (NOT SPATIALINDEX_FIND_QUIETLY)
MESSAGE(STATUS "Found Spatialindex: ${SPATIALINDEX_LIBRARY}")
MESSAGE(STATUS "Found Spatialindex: ${SPATIALINDEX_LIBRARY} (${SPATIALINDEX_VERSION})")
ENDIF (NOT SPATIALINDEX_FIND_QUIETLY)
ELSE (SPATIALINDEX_FOUND)
IF (SPATIALINDEX_FIND_REQUIRED)

View File

@ -26,8 +26,8 @@
# option for SIP.)
#
# SIP_CONCAT_PARTS - An integer which defines the number of parts the C++ code
# of each module should be split into. Defaults to 8. (Corresponds to the
# -j option for SIP.)
# of each module should be split into. (Corresponds to the -j option for
# SIP.)
#
# SIP_DISABLE_FEATURES - List of feature names which should be disabled
# running SIP. (Corresponds to the -x option for SIP.)
@ -40,7 +40,7 @@
SET(SIP_INCLUDES)
SET(SIP_TAGS)
SET(SIP_CONCAT_PARTS 16)
SET(SIP_CONCAT_PARTS 26)
SET(SIP_DISABLE_FEATURES)
SET(SIP_EXTRA_OPTIONS)
SET(SIP_EXTRA_OBJECTS)
@ -76,7 +76,6 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES
ENDFOREACH (_sip_file)
SET(_message "-DMESSAGE=Generating CPP code for module ${MODULE_NAME}")
SET(_sip_output_files)
# Suppress warnings
@ -106,21 +105,29 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES
IF (SIP_BUILD_EXECUTABLE)
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}) # Output goes in this dir.
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/out/${_child_module_name}) # Output goes in this dir.
FOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} )
IF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} )
SET(_sip_output_files ${_sip_output_files} ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip${_child_module_name}part${CONCAT_NUM}.cpp )
SET(_sip_output_files ${_sip_output_files} ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/out/${_child_module_name}/sip${_child_module_name}part${CONCAT_NUM}.cpp )
ENDIF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} )
ENDFOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} )
SET(SIPCMD ${SIP_BUILD_EXECUTABLE} --no-protected-is-public --pep484-pyi --no-make --concatenate=${SIP_CONCAT_PARTS} --qmake=${QMAKE_EXECUTABLE} --include-dir=${CMAKE_CURRENT_BINARY_DIR} --include-dir=${PYQT_SIP_DIR} --api-dir ${CMAKE_BINARY_DIR}/python ${SIP_BUILD_EXTRA_OPTIONS})
# Make our common files available in the SIP build
IF(WIN32)
set(SIP_PYTHONPATH "${CMAKE_SOURCE_DIR}\\python\\common;$ENV{PYTHONPATH}")
ELSE()
set(SIP_PYTHONPATH "${CMAKE_SOURCE_DIR}/python/common:$ENV{PYTHONPATH}")
ENDIF()
SET(_sip_disable_features ${SIP_DISABLE_FEATURES})
LIST(TRANSFORM _sip_disable_features PREPEND --disable-feature=)
SET(SIPCMD ${SIP_BUILD_EXECUTABLE} ${_sip_disable_features} --no-protected-is-public --pep484-pyi --no-make --concatenate=${SIP_CONCAT_PARTS} --qmake=${QMAKE_EXECUTABLE} --include-dir=${CMAKE_CURRENT_BINARY_DIR} --include-dir=${PYQT_SIP_DIR} --api-dir ${CMAKE_BINARY_DIR}/python ${SIP_BUILD_EXTRA_OPTIONS})
ADD_CUSTOM_COMMAND(
OUTPUT ${_sip_output_files}
COMMAND ${CMAKE_COMMAND} -E echo ${message}
COMMAND ${SIPCMD}
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${SIP_PYTHONPATH} ${SIPCMD}
WORKING_DIRECTORY ${_module_path}
MAIN_DEPENDENCY ${_configured_module_sip}
DEPENDS ${SIP_EXTRA_FILES_DEPEND}
@ -156,7 +163,6 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES
SET(SIPCMD ${SIP_BINARY_PATH} ${_sip_tags} -w -e ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} -I ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_configured_module_sip})
ADD_CUSTOM_COMMAND(
OUTPUT ${_sip_output_files}
COMMAND ${CMAKE_COMMAND} -E echo ${message}
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
COMMAND ${SIPCMD}
MAIN_DEPENDENCY ${_configured_module_sip}
@ -185,7 +191,7 @@ MACRO(BUILD_SIP_PYTHON_MODULE MODULE_NAME SIP_FILES EXTRA_OBJECTS)
ADD_LIBRARY(${_logical_name} MODULE ${_sip_output_files} ${EXTRA_OBJECTS})
SET_PROPERTY(TARGET ${_logical_name} PROPERTY AUTOMOC OFF)
TARGET_INCLUDE_DIRECTORIES(${_logical_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build)
TARGET_INCLUDE_DIRECTORIES(${_logical_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/out)
IF (${SIP_VERSION_STR} VERSION_LESS 5.0.0)
# require c++14 only -- sip breaks with newer versions due to reliance on throw(...) annotations removed in c++17

View File

@ -25,13 +25,13 @@ endif()
install(DIRECTORY "${PROJ_DATA_PATH}/" DESTINATION "${QGIS_DATA_SUBDIR}/proj")
install(DIRECTORY "${VCPKG_BASE_DIR}/share/gdal/" DESTINATION "${QGIS_DATA_SUBDIR}/gdal")
if(MSVC)
install(DIRECTORY "${VCPKG_BASE_DIR}/bin/Qca/crypto/" DESTINATION "${QGIS_LIB_SUBDIR}/Qt6/plugins/crypto") # QCA plugins
install(DIRECTORY "${VCPKG_BASE_DIR}/bin/Qca/crypto/" DESTINATION "${QGIS_BIN_SUBDIR}/Qt6/plugins/crypto") # QCA plugins
else()
install(DIRECTORY "${VCPKG_BASE_DIR}/bin/Qca/crypto/" DESTINATION "${APP_PLUGINS_DIR}/crypto") # QCA plugins
endif()
if(MSVC)
install(DIRECTORY "${VCPKG_BASE_DIR}/Qt6/" DESTINATION "${QGIS_LIB_SUBDIR}/Qt6") # qt plugins (qml and others)
install(DIRECTORY "${VCPKG_BASE_DIR}/Qt6/" DESTINATION "${QGIS_BIN_SUBDIR}/Qt6") # qt plugins (qml and others)
else()
install(DIRECTORY "${VCPKG_BASE_DIR}/Qt6/plugins/" DESTINATION "${APP_PLUGINS_DIR}/") # qt plugins (qml and others)
endif()

View File

@ -2439,7 +2439,8 @@ EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
"SIP_MONKEYPATCH_COMPAT_NAME" \
"SIP_MONKEYPATCH_SCOPEENUM" \
"SIP_MONKEYPATCH_SCOPEENUM_UNNEST" \
"SIP_MONKEYPATCH_FLAGS_UNNEST"
"SIP_MONKEYPATCH_FLAGS_UNNEST" \
"SIP_INSERT_QLIST_ENUM_CONVERSION_CODE"
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have

View File

@ -121,5 +121,8 @@
#cmakedefine HAVE_WEBENGINE
#endif
#cmakedefine SFCGAL_VERSION_MAJOR_INT ${SFCGAL_VERSION_MAJOR_INT}
#cmakedefine SFCGAL_VERSION_MINOR_INT ${SFCGAL_VERSION_MINOR_INT}
#cmakedefine SFCGAL_VERSION_PATCH_INT ${SFCGAL_VERSION_PATCH_INT}
#endif

4
debian/control.in vendored
View File

@ -21,7 +21,7 @@ Build-Depends:
libpq-dev,
libproj-dev,
libdraco-dev,
libspatialindex-dev,
#bookworm noble# libspatialindex-dev,
libspatialite-dev,
libmeshoptimizer-dev,
libsqlite3-dev,
@ -69,10 +69,12 @@ Build-Depends:
#qt6# python3-pyqt6, python3-pyqt6.qsci, python3-pyqt6.qtmultimedia, python3-pyqt6.qtpositioning, python3-pyqt6.qtserialport, python3-pyqt6.qtsvg, pyqt6-dev-tools, pyqt6-dev, pyqt6.qsci-dev, python3-pyqt6.sip,
#oracle# oracle-instantclient-basiclite, oracle-instantclient-devel,
#pdal# libpdal-dev, pdal,
#sfcgal# libsfcgal-dev (>= 2.0.0),
locales
#apidoc#Build-Depends-indep:
#apidoc# doxygen
Build-Conflicts:
libspatialindex-dev (>= 2.1.0),
libqgis-dev,
libqgis-qt6-dev,
qgis-dev

View File

@ -7,6 +7,8 @@ usr/lib/qgis-qt6/plugins/libauthmethod_identcert.so
usr/lib/qgis-qt6/plugins/libauthmethod_maptilerhmacsha256.so
usr/lib/qgis-qt6/plugins/libauthmethod_pkcs12.so
usr/lib/qgis-qt6/plugins/libauthmethod_pkipaths.so
usr/lib/qgis-qt6/plugins/libauthmethod_oauth2.so
usr/lib/qgis-qt6/plugins/libauthmethod_planetary_computer.so
usr/lib/qgis-qt6/plugins/libprovider_arcgisfeatureserver.so
usr/lib/qgis-qt6/plugins/libprovider_arcgismapserver.so
usr/lib/qgis-qt6/plugins/libprovider_delimitedtext.so

View File

@ -7,6 +7,8 @@ usr/lib/qgis/plugins/libauthmethod_identcert.so
usr/lib/qgis/plugins/libauthmethod_maptilerhmacsha256.so
usr/lib/qgis/plugins/libauthmethod_pkcs12.so
usr/lib/qgis/plugins/libauthmethod_pkipaths.so
usr/lib/qgis/plugins/libauthmethod_oauth2.so
usr/lib/qgis/plugins/libauthmethod_planetary_computer.so
usr/lib/qgis/plugins/libprovider_arcgisfeatureserver.so
usr/lib/qgis/plugins/libprovider_arcgismapserver.so
usr/lib/qgis/plugins/libprovider_delimitedtext.so

View File

@ -1,5 +1,4 @@
usr/lib/qgis-qt6/plugins/libplugin_geometrychecker.so
usr/lib/qgis-qt6/plugins/libauthmethod_oauth2.so
usr/lib/qgis-qt6/plugins/libplugin_offlineediting.so
usr/lib/qgis-qt6/plugins/libplugin_topology.so
usr/lib/qgis-qt6/qgiscrashhandler

1
debian/qgis.install vendored
View File

@ -1,5 +1,4 @@
usr/lib/qgis/plugins/libplugin_geometrychecker.so
usr/lib/qgis/plugins/libauthmethod_oauth2.so
usr/lib/qgis/plugins/libplugin_offlineediting.so
usr/lib/qgis/plugins/libplugin_topology.so
usr/lib/qgis/qgiscrashhandler

35
debian/rules vendored
View File

@ -47,7 +47,7 @@ else
DISTRIBUTION := $(DIST)
endif
ifeq (,$(filter $(DISTRIBUTION),bookworm trixie jammy kinetic lunar mantic noble oracular plucky))
ifeq (,$(filter $(DISTRIBUTION),bookworm trixie noble plucky questing))
DISTRIBUTION := sid
endif
@ -71,17 +71,17 @@ CONTROL_EXPRESSIONS = $(DISTRIBUTION) grass$(GRASSVER)
shlibs :=
ifneq (,$(filter $(DISTRIBUTION),bookworm trixie noble oracular plucky sid))
ifneq (,$(filter $(DISTRIBUTION),bookworm trixie noble plucky questing sid))
CONTROL_EXPRESSIONS += qt5
shlibs += -Xqgis-plugin-grass -Xlibqgis-customwidgets
ifneq (,$(filter $(DISTRIBUTION),bookworm noble oracular))
ifneq (,$(filter $(DISTRIBUTION),bookworm noble))
CONTROL_EXPRESSIONS += webkit
endif
endif
# bookworm: no qca for qt6
# noble: sip errors
ifneq (,$(filter $(DISTRIBUTION),trixie oracular plucky sid))
ifneq (,$(filter $(DISTRIBUTION),trixie plucky questing sid))
CONTROL_EXPRESSIONS += qt6
shlibs += -Xqgis-plugin-grass-qt6 -Xlibqgis-customwidgets-qt6
endif
@ -92,6 +92,10 @@ $(error neither qt5 nor qt6)
endif
endif
ifneq (,$(filter $(DISTRIBUTION),trixie plucky questing sid))
CONTROL_EXPRESSIONS += sfcgal
endif
ifneq (,$(filter oracle,$(DEB_BUILD_OPTIONS)))
CONTROL_EXPRESSIONS += oracle
@ -115,6 +119,10 @@ CONTROL_EXPRESSIONS += pdal_wrench
endif
endif
ifneq (,$(filter sfcgal,$(DEB_BUILD_OPTIONS)))
CONTROL_EXPRESSIONS += sfcgal
endif
define gentemplate
$(2): $(1)
rm -f $$@
@ -189,19 +197,22 @@ CMAKE_OPTS := \
-DSUBMIT_URL="https://cdash.orfeo-toolbox.org/submit.php?project=QGIS" \
-DPUSH_TO_CDASH=TRUE
ifneq (,$(filter $(DISTRIBUTION),trixie plucky questing sid))
CMAKE_OPTS += -DWITH_INTERNAL_SPATIALINDEX=TRUE
endif
QT5_CMAKE_OPTS = \
-D BUILD_WITH_QT6=FALSE \
-D BUILD_WITH_QT5=TRUE -D BUILD_WITH_QT6=FALSE -D WITH_QTWEBENGINE=OFF \
-D QGIS_INCLUDE_SUBDIR=include/qgis \
-D QT_PLUGINS_DIR=lib/$(DEB_BUILD_MULTIARCH)/qt5/plugins \
-D QGIS_QML_SUBDIR=share/qgis/qml
ifeq (,$(filter webkit,$(CONTROL_EXPRESSIONS)))
ifneq (,$(filter webkit,$(CONTROL_EXPRESSIONS)))
QT5_CMAKE_OPTS += \
-D WITH_QTWEBKIT=OFF
-D WITH_QTWEBKIT=ON
endif
QT6_CMAKE_OPTS = \
-D BUILD_WITH_QT6=TRUE -D WITH_QTWEBKIT=OFF -D WITH_QTWEBENGINE=ON \
-D QGIS_LIBEXEC_SUBDIR=lib/qgis-qt6 \
-D QGIS_PLUGIN_SUBDIR=lib/qgis-qt6/plugins \
-D QGIS_SERVER_MODULE_SUBDIR=lib/qgis-qt6/server \
@ -222,7 +233,7 @@ ifneq (,$(filter $(GRASSVER),7 8))
-DGRASS_PREFIX$(GRASSVER)=/usr/lib/$(GRASS)
endif
ifneq (,$(filter $(DISTRIBUTION),trixie sid kinetic lunar mantic noble oracular plucky))
ifneq (,$(filter $(DISTRIBUTION),trixie sid noble plucky questing))
CMAKE_OPTS += \
-DGDAL_LIBRARY=/usr/lib/$(DEB_BUILD_MULTIARCH)/libgdal.so
endif
@ -256,6 +267,12 @@ else
CMAKE_OPTS += -DWITH_PDAL=FALSE
endif
ifneq (,$(filter sfcgal,$(CONTROL_EXPRESSIONS)))
CMAKE_OPTS += -DWITH_SFCGAL=TRUE
else
CMAKE_OPTS += -DWITH_SFCGAL=FALSE
endif
ifneq (,$(filter oracle,$(DEB_BUILD_OPTIONS)))
ifeq ($(DEB_BUILD_ARCH),amd64)
ORACLE_INCLUDEDIR=$(wildcard /usr/include/oracle/*/client64/)

View File

@ -33,7 +33,7 @@ the documentation</a> available.
See \ref api_break for information about incompatible changes to API between releases.
Earlier versions of the documentation are also available on the QGIS website:
<a href="https://qgis.org/api/3.44">3.44</a>,
<a href="https://qgis.org/api/3.44">3.44 (LTR)</a>,
<a href="https://qgis.org/api/3.42">3.42</a>,
<a href="https://qgis.org/api/3.40">3.40 (LTR)</a>,
<a href="https://qgis.org/api/3.38">3.38</a>,

View File

@ -1,19 +1,24 @@
# Copyright (C) 2022-2023 Jakub Melka
# MIT License
#
# This file is part of PDF4QT.
# Copyright (c) 2018-2025 Jakub Melka and Contributors
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
add_library(Pdf4QtLibCore SHARED
sources/pdfglobal.h
@ -144,8 +149,17 @@ add_library(Pdf4QtLibCore SHARED
sources/pdfwidgetsnapshot.cpp
sources/pdfwidgetsnapshot.h
cmaps.qrc
aatl.qrc
sources/pdfcertificatestore.h
sources/pdfcertificatestore.cpp
sources/pdfblpainter.h
sources/pdfblpainter.cpp
sources/pdfpagecontenteditorprocessor.h
sources/pdfpagecontenteditorprocessor.cpp
sources/pdfpagecontenteditorcontentstreambuilder.h
sources/pdfpagecontenteditorcontentstreambuilder.cpp
sources/pdfapplicationtranslator.h
sources/pdfapplicationtranslator.cpp
)
include(GenerateExportHeader)
@ -155,7 +169,7 @@ GENERATE_EXPORT_HEADER(Pdf4QtLibCore
PDF4QTLIBCORESHARED_EXPORT
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibcore_export.h")
target_link_libraries(Pdf4QtLibCore PRIVATE ${QT_VERSION_BASE}::Core ${QT_VERSION_BASE}::Gui ${QT_VERSION_BASE}::Xml ${QT_VERSION_BASE}::Svg)
target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::Core Qt6::Gui Qt6::Xml Qt6::Svg)
target_link_libraries(Pdf4QtLibCore PRIVATE ${LCMS2_LIBRARIES})
target_link_libraries(Pdf4QtLibCore PRIVATE OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(Pdf4QtLibCore PRIVATE ZLIB::ZLIB)
@ -168,13 +182,10 @@ target_include_directories(Pdf4QtLibCore PRIVATE SYSTEM
${FREETYPE_INCLUDE_DIRS}
${Fontconfig_INCLUDE_DIRS})
if(PDF4QT_ENABLE_OPENGL)
target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::OpenGL)
if(LINUX_GCC)
# target_link_libraries(Pdf4QtLibCore PUBLIC TBB::tbb)
endif()
if(LINUX_GCC)
#target_link_libraries(Pdf4QtLibCore PUBLIC TBB::tbb)
endif()
if(MINGW)
target_link_libraries(Pdf4QtLibCore PRIVATE Secur32 Mscms Gdi32 User32 crypt32)
@ -183,10 +194,9 @@ endif()
target_include_directories(Pdf4QtLibCore INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/sources)
target_include_directories(Pdf4QtLibCore PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
# Workaround to suppress CLANG error on unused private field
set_source_files_properties(sources/pdfdocumentwriter.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-private-field")
# Workaround to suppress deprecation warning
set_source_files_properties(sources/pdfccittfaxdecoder.cpp PROPERTIES COMPILE_FLAGS "-Wno-deprecated-literal-operator")
find_library(blend2d blend2d REQUIRED)
target_include_directories(Pdf4QtLibCore PRIVATE ${blend2d_INCLUDES})
target_link_libraries(Pdf4QtLibCore PRIVATE blend2d)
set_target_properties(Pdf4QtLibCore PROPERTIES
VERSION ${PDF4QT_VERSION}

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>aatl/SecuritySettings.xml</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
http://trustlist.adobe.com/tl12.acrobatsecuritysettings

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfaction.h"
#include "pdfdocument.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFACTION_H
#define PDFACTION_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2021-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfalgorithmlcs.h"
#include "pdfdbgheap.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFALGORITHMLCS_H
#define PDFALGORITHMLCS_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfannotation.h"
#include "pdfdocument.h"
@ -24,7 +29,6 @@
#include "pdfparser.h"
#include "pdfform.h"
#include "pdfpainterutils.h"
#include "pdfdocumentbuilder.h"
#include <QtMath>
#include <QIcon>
@ -924,6 +928,11 @@ PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObject
annotation->m_content = PDFRichMediaContent::parse(storage, dictionary->get("RichMediaContent"));
annotation->m_settings = PDFRichMediaSettings::parse(storage, dictionary->get("RichMediaSettings"));
}
else
{
// Fill unknown annotation
result.reset(new PDFUnknownAnnotation());
}
if (!result)
{
@ -1422,10 +1431,12 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
const PDFColorConvertor& convertor,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
Q_UNUSED(layoutGetter);
Q_UNUSED(convertor);
const PDFPage* page = m_document->getCatalog()->getPage(pageIndex);
Q_ASSERT(page);
@ -1448,7 +1459,6 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
const PDFCMSPointer cms = m_cmsManager->getCurrentCMS();
m_fontCache->setCacheShrinkEnabled(&fontCacheLock, false);
const PageAnnotation* annotationDrawnByEditor = nullptr;
for (const PageAnnotation& annotation : annotations.annotations)
{
// If annotation draw is not enabled, then skip it
@ -1457,19 +1467,7 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
continue;
}
if (isAnnotationDrawnByEditor(annotation))
{
Q_ASSERT(!annotationDrawnByEditor);
annotationDrawnByEditor = &annotation;
continue;
}
drawAnnotation(annotation, pagePointToDevicePointMatrix, page, cms.data(), false, errors, painter);
}
if (annotationDrawnByEditor)
{
drawAnnotation(*annotationDrawnByEditor, pagePointToDevicePointMatrix, page, cms.data(), true, errors, painter);
drawAnnotation(annotation, pagePointToDevicePointMatrix, page, cms.data(), isAnnotationDrawnByEditor(annotation), errors, painter);
}
m_fontCache->setCacheShrinkEnabled(&fontCacheLock, true);
@ -2916,7 +2914,7 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const
QPainter& painter = *parameters.painter;
painter.setCompositionMode(getCompositionMode());
QString text = getText(m_stamp);
QString text = getText(m_stamp, false);
QColor color(Qt::red);
switch (m_stamp)
@ -3004,66 +3002,80 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const
parameters.boundingRectangle.adjust(-penWidth, -penWidth, penWidth, penWidth);
}
QString PDFStampAnnotation::getText(Stamp stamp)
QString PDFStampAnnotation::getText(Stamp stamp, bool isActionText)
{
QString text;
switch (stamp)
{
case Stamp::Approved:
text = PDFTranslationContext::tr("APPROVED");
text = isActionText ? PDFTranslationContext::tr("&Approved")
: PDFTranslationContext::tr("APPROVED");
break;
case Stamp::AsIs:
text = PDFTranslationContext::tr("AS IS");
text = isActionText ? PDFTranslationContext::tr("As &Is")
: PDFTranslationContext::tr("AS IS");
break;
case Stamp::Confidential:
text = PDFTranslationContext::tr("CONFIDENTIAL");
text = isActionText ? PDFTranslationContext::tr("&Confidential")
: PDFTranslationContext::tr("CONFIDENTIAL");
break;
case Stamp::Departmental:
text = PDFTranslationContext::tr("DEPARTMENTAL");
text = isActionText ? PDFTranslationContext::tr("&Departmental")
: PDFTranslationContext::tr("DEPARTMENTAL");
break;
case Stamp::Draft:
text = PDFTranslationContext::tr("DRAFT");
text = isActionText ? PDFTranslationContext::tr("Dra&ft")
: PDFTranslationContext::tr("DRAFT");
break;
case Stamp::Experimental:
text = PDFTranslationContext::tr("EXPERIMENTAL");
text = isActionText ? PDFTranslationContext::tr("&Experimental")
: PDFTranslationContext::tr("EXPERIMENTAL");
break;
case Stamp::Expired:
text = PDFTranslationContext::tr("EXPIRED");
text = isActionText ? PDFTranslationContext::tr("E&xpired")
: PDFTranslationContext::tr("EXPIRED");
break;
case Stamp::Final:
text = PDFTranslationContext::tr("FINAL");
text = isActionText ? PDFTranslationContext::tr("Fina&l")
: PDFTranslationContext::tr("FINAL");
break;
case Stamp::ForComment:
text = PDFTranslationContext::tr("FOR COMMENT");
text = isActionText ? PDFTranslationContext::tr("For Co&mment")
: PDFTranslationContext::tr("FOR COMMENT");
break;
case Stamp::ForPublicRelease:
text = PDFTranslationContext::tr("FOR PUBLIC RELEASE");
text = isActionText ? PDFTranslationContext::tr("For P&ublic Release")
: PDFTranslationContext::tr("FOR PUBLIC RELEASE");
break;
case Stamp::NotApproved:
text = PDFTranslationContext::tr("NOT APPROVED");
text = isActionText ? PDFTranslationContext::tr("Not A&pproved")
: PDFTranslationContext::tr("NOT APPROVED");
break;
case Stamp::NotForPublicRelease:
text = PDFTranslationContext::tr("NOT FOR PUBLIC RELEASE");
text = isActionText ? PDFTranslationContext::tr("N&ot For Public Release")
: PDFTranslationContext::tr("NOT FOR PUBLIC RELEASE");
break;
case Stamp::Sold:
text = PDFTranslationContext::tr("SOLD");
text = isActionText ? PDFTranslationContext::tr("&Sold")
: PDFTranslationContext::tr("SOLD");
break;
case Stamp::TopSecret:
text = PDFTranslationContext::tr("TOP SECRET");
text = isActionText ? PDFTranslationContext::tr("&Top Secret")
: PDFTranslationContext::tr("TOP SECRET");
break;
default:

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFANNOTATION_H
#define PDFANNOTATION_H
@ -84,7 +89,8 @@ enum class AnnotationType
Redact,
Projection,
_3D,
RichMedia
RichMedia,
Unknown
};
enum class AnnotationLineEnding
@ -1118,7 +1124,7 @@ public:
void setStamp(const Stamp& stamp);
void setIntent(const StampIntent& intent);
static QString getText(Stamp stamp);
static QString getText(Stamp stamp, bool isActionText);
private:
friend PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObjectReference reference);
@ -1317,6 +1323,15 @@ public:
virtual AnnotationType getType() const override { return AnnotationType::TrapNet; }
};
/// Unknown (not recognized) annotation.
class PDFUnknownAnnotation : public PDFAnnotation
{
public:
inline explicit PDFUnknownAnnotation() = default;
virtual AnnotationType getType() const override { return AnnotationType::Unknown; }
};
/// Watermark annotation represents watermark displayed on the page,
/// for example, if it is printed. Watermarks are displayed at fixed
/// position and size on the page.
@ -1464,6 +1479,7 @@ public:
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
const PDFColorConvertor& convertor,
QList<PDFRenderError>& errors) const;
/// Set document

View File

@ -0,0 +1,205 @@
// MIT License
//
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfapplicationtranslator.h"
#include <QDir>
#include <QSettings>
#include <QMetaEnum>
#include <QCoreApplication>
namespace pdf
{
PDFApplicationTranslator::PDFApplicationTranslator()
{
}
PDFApplicationTranslator::~PDFApplicationTranslator()
{
uninstallTranslator();
}
PDFApplicationTranslator::ELanguage PDFApplicationTranslator::getLanguage() const
{
return m_language;
}
void PDFApplicationTranslator::installTranslator()
{
QDir applicationDirectory(QCoreApplication::applicationDirPath());
applicationDirectory.cd("translations");
QString translationPath = applicationDirectory.absolutePath();
Q_ASSERT(!m_translator);
m_translator = new QTranslator();
switch (m_language)
{
case E_LANGUAGE_AUTOMATIC_SELECTION:
{
if (m_translator->load(QLocale::system(), "PDF4QT", "_", translationPath))
{
QCoreApplication::installTranslator(m_translator);
}
else
{
delete m_translator;
m_translator = nullptr;
}
break;
}
case E_LANGUAGE_ENGLISH:
case E_LANGUAGE_CZECH:
case E_LANGUAGE_GERMAN:
case E_LANGUAGE_KOREAN:
case E_LANGUAGE_SPANISH:
case E_LANGUAGE_CHINESE:
case E_LANGUAGE_FRENCH:
case E_LANGUAGE_TURKISH:
case E_LANGUAGE_RUSSIAN:
{
QString languageFileName = getLanguageFileName();
if (m_translator->load(languageFileName, translationPath))
{
QCoreApplication::installTranslator(m_translator);
}
else
{
delete m_translator;
m_translator = nullptr;
}
break;
}
default:
{
delete m_translator;
m_translator = nullptr;
Q_ASSERT(false);
break;
}
}
}
void PDFApplicationTranslator::uninstallTranslator()
{
if (m_translator)
{
QCoreApplication::removeTranslator(m_translator);
delete m_translator;
m_translator = nullptr;
}
}
void PDFApplicationTranslator::loadSettings()
{
QMetaEnum metaEnum = QMetaEnum::fromType<ELanguage>();
std::string languageKeyString = loadLanguageKeyFromSettings().toStdString();
std::optional<quint64> value = metaEnum.keyToValue(languageKeyString.c_str());
m_language = static_cast<ELanguage>(value.value_or(E_LANGUAGE_AUTOMATIC_SELECTION));
}
void PDFApplicationTranslator::saveSettings()
{
QMetaEnum metaEnum = QMetaEnum::fromType<ELanguage>();
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
settings.beginGroup("Language");
settings.setValue("language", metaEnum.valueToKey(m_language));
settings.endGroup();
}
void PDFApplicationTranslator::setLanguage(ELanguage newLanguage)
{
m_language = newLanguage;
}
void PDFApplicationTranslator::saveSettings(QSettings& settings, ELanguage language)
{
QMetaEnum metaEnum = QMetaEnum::fromType<ELanguage>();
settings.beginGroup("Language");
settings.setValue("language", metaEnum.valueToKey(language));
settings.endGroup();
}
PDFApplicationTranslator::ELanguage PDFApplicationTranslator::loadSettings(QSettings& settings)
{
QMetaEnum metaEnum = QMetaEnum::fromType<ELanguage>();
std::string languageKeyString = loadLanguageKeyFromSettings(settings).toStdString();
std::optional<quint64> value = metaEnum.keyToValue(languageKeyString.c_str());
return static_cast<ELanguage>(value.value_or(E_LANGUAGE_AUTOMATIC_SELECTION));
}
QString PDFApplicationTranslator::loadLanguageKeyFromSettings()
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
return loadLanguageKeyFromSettings(settings);
}
QString PDFApplicationTranslator::loadLanguageKeyFromSettings(QSettings& settings)
{
QMetaEnum metaEnum = QMetaEnum::fromType<ELanguage>();
settings.beginGroup("Language");
QString languageKey = settings.value("language", metaEnum.valueToKey(E_LANGUAGE_AUTOMATIC_SELECTION)).toString();
settings.endGroup();
return languageKey;
}
QString PDFApplicationTranslator::getLanguageFileName() const
{
switch (m_language)
{
case E_LANGUAGE_ENGLISH:
return QLatin1String("PDF4QT_en.qm");
case E_LANGUAGE_CZECH:
return QLatin1String("PDF4QT_cs.qm");
case E_LANGUAGE_GERMAN:
return QLatin1String("PDF4QT_de.qm");
case E_LANGUAGE_KOREAN:
return QLatin1String("PDF4QT_es.qm");
case E_LANGUAGE_SPANISH:
return QLatin1String("PDF4QT_ko.qm");
case E_LANGUAGE_CHINESE:
return QLatin1String("PDF4QT_zh_CN.qm");
case E_LANGUAGE_FRENCH:
return QLatin1String("PDF4QT_fr.qm");
case E_LANGUAGE_TURKISH:
return QLatin1String("PDF4QT_tr.qm");
case E_LANGUAGE_RUSSIAN:
return QLatin1String("PDF4QT_ru.qm");
default:
Q_ASSERT(false);
}
return QString();
}
} // namespace

View File

@ -0,0 +1,82 @@
// MIT License
//
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFAPPLICATIONTRANSLATOR_H
#define PDFAPPLICATIONTRANSLATOR_H
#include "pdfglobal.h"
#include <QTranslator>
class QSettings;
namespace pdf
{
class PDF4QTLIBCORESHARED_EXPORT PDFApplicationTranslator
{
Q_GADGET
public:
explicit PDFApplicationTranslator();
~PDFApplicationTranslator();
enum ELanguage
{
E_LANGUAGE_AUTOMATIC_SELECTION,
E_LANGUAGE_ENGLISH,
E_LANGUAGE_CZECH,
E_LANGUAGE_GERMAN,
E_LANGUAGE_KOREAN,
E_LANGUAGE_SPANISH,
E_LANGUAGE_CHINESE,
E_LANGUAGE_FRENCH,
E_LANGUAGE_TURKISH,
E_LANGUAGE_RUSSIAN
};
Q_ENUM(ELanguage)
void installTranslator();
void uninstallTranslator();
void loadSettings();
void saveSettings();
ELanguage getLanguage() const;
void setLanguage(ELanguage newLanguage);
static ELanguage loadSettings(QSettings& settings);
static void saveSettings(QSettings& settings, ELanguage language);
private:
static QString loadLanguageKeyFromSettings(QSettings& settings);
QString loadLanguageKeyFromSettings();
QString getLanguageFileName() const;
QTranslator* m_translator = nullptr;
ELanguage m_language = E_LANGUAGE_AUTOMATIC_SELECTION;
};
} // namespace
#endif // PDFAPPLICATIONTRANSLATOR_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfblendfunction.h"
#include "pdfdbgheap.h"
@ -168,6 +173,19 @@ QPainter::CompositionMode PDFBlendModeInfo::getCompositionModeFromBlendMode(Blen
return QPainter::CompositionMode_SourceOver;
}
BlendMode PDFBlendModeInfo::getBlendModeFromCompositionMode(QPainter::CompositionMode mode)
{
for (BlendMode blendMode : getBlendModes())
{
if (mode == getCompositionModeFromBlendMode(blendMode))
{
return blendMode;
}
}
return BlendMode::Normal;
}
QString PDFBlendModeInfo::getBlendModeName(BlendMode mode)
{
for (const std::pair<const char*, BlendMode>& info : BLEND_MODE_INFOS)

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFBLENDFUNCTION_H
#define PDFBLENDFUNCTION_H
@ -86,6 +91,9 @@ public:
/// \param mode Blend mode
static QPainter::CompositionMode getCompositionModeFromBlendMode(BlendMode mode);
/// Returns blend mode from QPainter's composition mode.
static BlendMode getBlendModeFromCompositionMode(QPainter::CompositionMode mode);
/// Returns blend mode name
/// \param mode Blend mode
static QString getBlendModeName(BlendMode mode);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
// MIT License
//
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFBLPAINTER_H
#define PDFBLPAINTER_H
#include "pdfglobal.h"
#include <QImage>
#include <QPaintDevice>
namespace pdf
{
class PDFBLPaintEngine;
class PDF4QTLIBCORESHARED_EXPORT PDFBLPaintDevice : public QPaintDevice
{
public:
PDFBLPaintDevice(QImage& offscreenBuffer, bool isMultithreaded);
virtual ~PDFBLPaintDevice() override;
virtual int devType() const override;
virtual QPaintEngine* paintEngine() const override;
static uint32_t getVersion();
protected:
virtual int metric(PaintDeviceMetric metric) const override;
private:
QImage& m_offscreenBuffer;
PDFBLPaintEngine* m_paintEngine;
};
} // namespace pdf
#endif // PDFBLPAINTER_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2018-2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfcatalog.h"
#include "pdfdocument.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2018-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCATALOG_H
#define PDFCATALOG_H

View File

@ -1,20 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfccittfaxdecoder.h"
#include "pdfexception.h"
@ -24,7 +28,7 @@ namespace pdf
{
template<char... Digits>
constexpr uint8_t operator "" _bitlength()
constexpr uint8_t operator ""_bitlength()
{
return sizeof...(Digits);
}

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCCITTFAXDECODER_H
#define PDFCCITTFAXDECODER_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfcertificatemanager.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2022-2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCERTIFICATEMANAGER_H
#define PDFCERTIFICATEMANAGER_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2022-2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfcertificatestore.h"
#include "pdfutils.h"
@ -34,12 +39,14 @@
#include <openssl/rsaerr.h>
#include <openssl/ts.h>
#include <openssl/tserr.h>
#include <openssl/pem.h>
#include <QDir>
#include <QFileInfo>
#include <QLockFile>
#include <QDataStream>
#include <QStandardPaths>
#include <QDomDocument>
#include "pdfdbgheap.h"
@ -468,6 +475,70 @@ void PDFCertificateStore::createDirectoryForDefaultUserCertificatesStore()
QDir().mkpath(path);
}
PDFCertificateEntries PDFCertificateStore::getAATLCertificates()
{
PDFCertificateEntries result;
QFile aatlFile(":/aatl/SecuritySettings.xml");
if (aatlFile.open(QFile::ReadOnly))
{
QString errorMessage;
QDomDocument aatlDocument;
if (aatlDocument.setContent(&aatlFile, &errorMessage))
{
// Najdeme kořenový element
QDomElement root = aatlDocument.documentElement();
// Seek path "SecuritySettings/TrustedIdentities/Identity/Certificate"
QDomNodeList identities = root.firstChildElement("TrustedIdentities").elementsByTagName("Identity");
for (int i = 0; i < identities.count(); ++i)
{
QDomNode identityNode = identities.at(i);
QDomElement certificateElement = identityNode.firstChildElement("Certificate");
if (!certificateElement.isNull())
{
QString text = certificateElement.text();
QString pemFormattedText = QString("-----BEGIN CERTIFICATE-----\n%1\n-----END CERTIFICATE-----").arg(text);
QByteArray certificateData = pemFormattedText.toLatin1();
// Read PEM certificate to the OpenSSL X509
BIO* bio = BIO_new_mem_buf(certificateData.constData(), certificateData.size());
X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr);
BIO_free(bio);
if (!cert)
{
continue;
}
// Převést certifikát na DER
int len = i2d_X509(cert, nullptr);
QByteArray derData(len, 0);
unsigned char *derPtr = reinterpret_cast<unsigned char*>(derData.data());
i2d_X509(cert, &derPtr);
X509_free(cert);
std::optional<PDFCertificateInfo> info = PDFCertificateInfo::getCertificateInfo(derData);
if (info)
{
PDFCertificateEntry entry;
entry.type = PDFCertificateEntry::EntryType::AATL;
entry.info = qMove(*info);
result.emplace_back(qMove(entry));
}
}
}
}
aatlFile.close();
}
return result;
}
} // namespace pdf
#ifdef Q_OS_WIN

View File

@ -1,19 +1,24 @@
// Copyright (C) 2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCERTIFICATESTORE_H
#define PDFCERTIFICATESTORE_H
@ -39,11 +44,7 @@ public:
inline ~PDFOpenSSLGlobalLock() = default;
private:
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMutexLocker<QRecursiveMutex> m_mutexLocker;
#else
QMutexLocker m_mutexLocker;
#endif
static QRecursiveMutex s_globalOpenSSLMutex;
};
@ -174,6 +175,7 @@ struct PDFCertificateEntry
{
User, ///< Certificate has been added manually by the user
System, ///< System certificate
AATL, ///< Trusted list
};
void serialize(QDataStream& stream) const;
@ -242,6 +244,9 @@ public:
/// Creates default directory for certificate store
void createDirectoryForDefaultUserCertificatesStore();
/// Returns a list of aatl certificates
static PDFCertificateEntries getAATLCertificates();
/// Returns a list of system certificates
static PDFCertificateEntries getSystemCertificates();

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfcms.h"
#include "pdfdocument.h"
@ -1232,11 +1237,7 @@ cmsHTRANSFORM PDFLittleCMS::getTransformBetweenColorSpaces(const PDFCMS::ColorSp
QString getInfoFromProfile(cmsHPROFILE profile, cmsInfoType infoType)
{
QLocale locale;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QString country = QLocale::territoryToString(locale.territory());
#else
QString country = QLocale::countryToString(locale.country());
#endif
QString language = QLocale::languageToString(locale.language());
char countryCode[3] = { };
@ -1497,11 +1498,7 @@ PDFCMSSettings PDFCMSManager::getDefaultSettings() const
void PDFCMSManager::setDocument(const PDFDocument* document)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
std::optional<QMutexLocker<QRecursiveMutex>> lock;
#else
std::optional<QMutexLocker> lock;
#endif
lock.emplace(&m_mutex);
if (m_document == document)

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCMS_H
#define PDFCMS_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfcolorconvertor.h"
#include "pdfimageconversion.h"
@ -116,17 +121,10 @@ QImage PDFColorConvertor::convert(QImage image) const
case Mode::Grayscale:
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QImage alpha = image.convertedTo(QImage::Format_Alpha8);
QImage grayscaleImage = image.convertedTo(QImage::Format_Grayscale8);
#else
QImage alpha = image;
alpha.convertTo(QImage::Format_Alpha8);
QImage grayscaleImage = image;
grayscaleImage.convertTo(QImage::Format_Grayscale8);
#endif
QImage resultImage = grayscaleImage;
resultImage.convertTo(QImage::Format_ARGB32);
resultImage = resultImage.convertedTo(QImage::Format_ARGB32);
resultImage.setAlphaChannel(std::move(alpha));
return resultImage;
}
@ -232,6 +230,20 @@ QColor PDFColorConvertor::getForegroundColor() const
return m_foregroundColor;
}
QPen PDFColorConvertor::convert(const QPen& pen, bool background, bool foreground) const
{
QPen newPen = pen;
newPen.setColor(convert(pen.color(), background, foreground));
return newPen;
}
QBrush PDFColorConvertor::convert(const QBrush& brush, bool background, bool foreground) const
{
QBrush newBrush = brush;
newBrush.setColor(convert(brush.color(), background, foreground));
return newBrush;
}
QColor PDFColorConvertor::getBackgroundColor() const
{
return m_backgroundColor;

View File

@ -1,25 +1,32 @@
// Copyright (C) 2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCOLORCONVERTOR_H
#define PDFCOLORCONVERTOR_H
#include "pdfglobal.h"
#include <QPen>
#include <QBrush>
#include <QColor>
#include <QImage>
@ -103,6 +110,9 @@ public:
QColor getBackgroundColor() const;
QColor getForegroundColor() const;
QPen convert(const QPen& pen, bool background = false, bool foreground = true) const;
QBrush convert(const QBrush& brush, bool background = false, bool foreground = true) const;
private:
/// Correct lightness using sigmoid function
/// \return Adjusted lightness normalized in range [0.0, 1.0]

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfcolorspaces.h"
#include "pdfobject.h"
@ -322,11 +327,7 @@ QImage PDFAbstractColorSpace::getImage(const PDFImageData& imageData,
const unsigned int imageHeight = imageData.getHeight();
QImage alphaMask = createAlphaMask(softMask);
if (alphaMask.size() != image.size())
{
// Scale the alpha mask, if it is masked
alphaMask = alphaMask.scaled(image.size());
}
QSize targetSize = getLargerSizeByArea(alphaMask.size(), image.size());
QMutex exceptionMutex;
std::optional<PDFException> exception;
@ -347,7 +348,6 @@ QImage PDFAbstractColorSpace::getImage(const PDFImageData& imageData,
const double max = reader.max();
const double coefficient = 1.0 / max;
unsigned char* outputLine = image.scanLine(i);
unsigned char* alphaLine = alphaMask.scanLine(i);
std::vector<float> inputColors(imageWidth * componentCount, 0.0f);
std::vector<unsigned char> outputColors(imageWidth * 3, 0);
@ -379,7 +379,7 @@ QImage PDFAbstractColorSpace::getImage(const PDFImageData& imageData,
*outputLine++ = *transformedLine++;
*outputLine++ = *transformedLine++;
*outputLine++ = *transformedLine++;
*outputLine++ = *alphaLine++;
*outputLine++ = 255;
}
}
catch (const PDFException &lineException)
@ -400,6 +400,18 @@ QImage PDFAbstractColorSpace::getImage(const PDFImageData& imageData,
throw *exception;
}
if (image.size() != targetSize)
{
image = image.scaled(targetSize);
}
if (alphaMask.size() != targetSize)
{
alphaMask = alphaMask.scaled(targetSize);
}
image.setAlphaChannel(alphaMask);
return image;
}
@ -1032,6 +1044,21 @@ bool PDFAbstractColorSpace::transform(const PDFAbstractColorSpace* source,
return true;
}
QSize PDFAbstractColorSpace::getLargerSizeByArea(QSize s1, QSize s2)
{
int area1 = s1.width() * s1.height();
int area2 = s2.width() * s2.height();
if (area1 > area2)
{
return s1;
}
else
{
return s2;
}
}
PDFColorSpacePointer PDFAbstractColorSpace::createColorSpaceImpl(const PDFDictionary* colorSpaceDictionary,
const PDFDocument* document,
const PDFObject& colorSpace,
@ -1947,11 +1974,7 @@ QImage PDFIndexedColorSpace::getImage(const PDFImageData& imageData,
color.resize(1);
QImage alphaMask = createAlphaMask(softMask);
if (alphaMask.size() != image.size())
{
// Scale the alpha mask, if it is masked
alphaMask = alphaMask.scaled(image.size());
}
QSize targetSize = getLargerSizeByArea(alphaMask.size(), image.size());
for (unsigned int i = 0, rowCount = imageData.getHeight(); i < rowCount; ++i)
{
@ -1963,7 +1986,6 @@ QImage PDFIndexedColorSpace::getImage(const PDFImageData& imageData,
reader.seek(i * imageData.getStride());
unsigned char* outputLine = image.scanLine(i);
unsigned char* alphaLine = alphaMask.scanLine(i);
for (unsigned int j = 0; j < imageData.getWidth(); ++j)
{
@ -1976,10 +1998,22 @@ QImage PDFIndexedColorSpace::getImage(const PDFImageData& imageData,
*outputLine++ = qRed(rgb);
*outputLine++ = qGreen(rgb);
*outputLine++ = qBlue(rgb);
*outputLine++ = *alphaLine++;
*outputLine++ = 255;
}
}
if (image.size() != targetSize)
{
image = image.scaled(targetSize);
}
if (alphaMask.size() != targetSize)
{
alphaMask = alphaMask.scaled(targetSize);
}
image.setAlphaChannel(alphaMask);
return image;
}

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCOLORSPACES_H
#define PDFCOLORSPACES_H
@ -456,6 +461,8 @@ public:
PDFRenderErrorReporter* reporter);
protected:
static QSize getLargerSizeByArea(QSize s1, QSize s2);
/// Clips the color component to range [0, 1]
static constexpr PDFColorComponent clip01(PDFColorComponent component) { return qBound<PDFColorComponent>(PDFColorComponent(0.0), component, PDFColorComponent(1.0)); }

View File

@ -1,20 +1,24 @@
// Copyright (C) 2018-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFCONSTANTS_H
#define PDFCONSTANTS_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDBGHEAP_H
#define PDFDBGHEAP_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdiff.h"
#include "pdfrenderer.h"
@ -884,13 +889,8 @@ void PDFDiff::finalizeGraphicsPieces(PDFDiffPageContext& context)
continue;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QByteArrayView view(reinterpret_cast<const char*>(info.hash.data()), info.hash.size());
hasher.addData(view);
#else
hasher.addData(reinterpret_cast<const char*>(info.hash.data()), info.hash.size());
#endif
}
QByteArray hash = hasher.result();

View File

@ -1,19 +1,24 @@
// Copyright (C) 2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDIFF_H
#define PDFDIFF_H

View File

@ -1,20 +1,24 @@
// Copyright (C) 2018-2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocument.h"
#include "pdfencoding.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2018-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENT_H
#define PDFDOCUMENT_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocumentbuilder.h"
#include "pdfencoding.h"
@ -285,6 +290,12 @@ PDFObjectFactory& PDFObjectFactory::operator<<(AnnotationBorderStyle style)
return *this;
}
PDFObjectFactory& PDFObjectFactory::operator<<(PDFDictionary dictionary)
{
*this << PDFObject::createDictionary(std::make_shared<pdf::PDFDictionary>(std::move(dictionary)));
return *this;
}
PDFObjectFactory& PDFObjectFactory::operator<<(const QDateTime& dateTime)
{
addObject(PDFObject::createString(PDFEncoding::convertDateTimeToString(dateTime)));
@ -506,11 +517,7 @@ PDFObject PDFObjectFactory::createTextString(QString textString)
{
QTextStream textStream(&ba, QIODevice::WriteOnly);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
textStream.setEncoding(QStringConverter::Utf16BE);
#else
textStream.setCodec("UTF-16BE");
#endif
textStream.setGenerateByteOrderMark(true);
textStream << textString;
}
@ -712,6 +719,19 @@ PDFDocument PDFDocumentBuilder::build()
return PDFDocument(PDFObjectStorage(m_storage), m_version, QByteArray());
}
void PDFDocumentBuilder::replaceObjectsByReferences(PDFDictionary& dictionary)
{
for (size_t i = 0; i < dictionary.getCount(); ++i)
{
const PDFObject& object = dictionary.getValue(i);
if (!object.isReference())
{
auto key = dictionary.getKey(i);
dictionary.setEntry(key, PDFObject::createReference(addObject(object)));
}
}
}
QByteArray PDFDocumentBuilder::getDecodedStream(const PDFStream* stream) const
{
return m_storage.getDecodedStream(stream);
@ -1269,6 +1289,19 @@ void PDFDocumentBuilder::mergeNames(PDFObjectReference a, PDFObjectReference b)
const PDFDictionary* aDict = getDictionaryFromObject(aObject);
const PDFDictionary* bDict = getDictionaryFromObject(bObject);
PDFDictionary aDictDummy;
PDFDictionary bDictDummy;
if (!aDict)
{
aDict = &aDictDummy;
}
if (!bDict)
{
bDict = &bDictDummy;
}
// Store keys
std::set<QByteArray> keys;
for (size_t i = 0; i < aDict->getCount(); ++i)

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENTBUILDER_H
#define PDFDOCUMENTBUILDER_H
@ -133,6 +138,7 @@ public:
PDFObjectFactory& operator<<(const PDFDestination& destination);
PDFObjectFactory& operator<<(PageRotation pageRotation);
PDFObjectFactory& operator<<(PDFFormSubmitFlags flags);
PDFObjectFactory& operator<<(PDFDictionary dictionary);
/// Treat containers - write them as array
template<typename Container, typename ValueType = decltype(*std::begin(std::declval<Container>()))>
@ -343,6 +349,9 @@ public:
/// if document being built was invalid.
PDFDocument build();
/// Replaces all objects by references in the dictionary
void replaceObjectsByReferences(PDFDictionary& dictionary);
/// If object is reference, the dereference attempt is performed
/// and object is returned. If it is not a reference, then self
/// is returned. If dereference attempt fails, then null object

View File

@ -1,19 +1,24 @@
// Copyright (C) 2021-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocumentmanipulator.h"
#include "pdfdocumentbuilder.h"
@ -37,6 +42,7 @@ PDFOperationResult PDFDocumentManipulator::assemble(const AssembledPages& pages)
try
{
classify(pages);
const PDFDocument* singleDocument = nullptr;
pdf::PDFDocumentBuilder documentBuilder;
if (m_flags.testFlag(SingleDocument))
@ -56,7 +62,8 @@ PDFOperationResult PDFDocumentManipulator::assemble(const AssembledPages& pages)
throw PDFException(tr("Invalid document."));
}
documentBuilder.setDocument(m_documents.at(documentIndex));
singleDocument = m_documents.at(documentIndex);
documentBuilder.setDocument(singleDocument);
}
else
{
@ -72,9 +79,13 @@ PDFOperationResult PDFDocumentManipulator::assemble(const AssembledPages& pages)
// Correct page tree (invalid parents are present)
documentBuilder.flattenPageTree();
if (!m_flags.testFlag(SingleDocument) || m_flags.testFlag(RemovedPages))
if (!m_flags.testFlag(SingleDocument))
{
documentBuilder.removeOutline();
}
if (!m_flags.testFlag(SingleDocument) || m_flags.testFlag(RemovedPages))
{
documentBuilder.removeThreads();
documentBuilder.removeDocumentActions();
documentBuilder.removeStructureTree();
@ -86,6 +97,10 @@ PDFOperationResult PDFDocumentManipulator::assemble(const AssembledPages& pages)
{
addOutlineAndDocumentParts(documentBuilder, pages, adjustedPages);
}
else if (m_flags.testFlag(RemovedPages) && singleDocument)
{
filterOutline(documentBuilder, singleDocument, adjustedPages);
}
pdf::PDFDocument mergedDocument = documentBuilder.build();
@ -487,6 +502,46 @@ void PDFDocumentManipulator::finalizeDocument(PDFDocument* document)
m_assembledDocument = finalBuilder.build();
}
void PDFDocumentManipulator::filterOutline(PDFDocumentBuilder& documentBuilder,
const PDFDocument* singleDocument,
const std::vector<PDFObjectReference>& adjustedPages)
{
QSharedPointer<PDFOutlineItem> outline = singleDocument->getCatalog()->getOutlineRootPtr();
if (outline)
{
outline = outline->clone();
std::set<PDFObjectReference> adjustedPagesSet(adjustedPages.cbegin(), adjustedPages.cend());
std::function<void(QSharedPointer<PDFOutlineItem>&)> filter = [&adjustedPagesSet](QSharedPointer<PDFOutlineItem>& item)
{
for (size_t i = 0; i < item->getChildCount();)
{
bool shouldRemove = false;
const PDFOutlineItem* childItem = item->getChild(i);
const PDFAction* action = childItem->getAction();
const PDFActionGoTo* actionGoTo = dynamic_cast<const PDFActionGoTo*>(action);
if (actionGoTo)
{
const PDFObjectReference pageReference = actionGoTo->getDestination().getPageReference();
shouldRemove = !adjustedPagesSet.count(pageReference);
}
if (shouldRemove)
{
item->removeChild(i);
}
else
{
++i;
}
}
};
filter(outline);
documentBuilder.setOutline(outline.data());
}
}
void PDFDocumentManipulator::addOutlineAndDocumentParts(PDFDocumentBuilder& documentBuilder,
const AssembledPages& pages,
const std::vector<PDFObjectReference>& adjustedPages)

View File

@ -1,19 +1,24 @@
// Copyright (C) 2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENTMANIPULATOR_H
#define PDFDOCUMENTMANIPULATOR_H
@ -145,6 +150,9 @@ private:
void addOutlineAndDocumentParts(PDFDocumentBuilder& documentBuilder,
const AssembledPages& pages,
const std::vector<PDFObjectReference>& adjustedPages);
void filterOutline(PDFDocumentBuilder& documentBuilder,
const PDFDocument* singleDocument,
const std::vector<PDFObjectReference>& adjustedPages);
std::map<PDFInteger, const PDFDocument*> m_documents;
std::map<PDFInteger, QImage> m_images;

View File

@ -1,20 +1,24 @@
// Copyright (C) 2018-2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocumentreader.h"
#include "pdfconstants.h"

View File

@ -1,20 +1,24 @@
// Copyright (C) 2018-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENTREADER_H
#define PDFDOCUMENTREADER_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocumentsanitizer.h"
#include "pdfvisitor.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENTSANITIZER_H
#define PDFDOCUMENTSANITIZER_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocumenttextflow.h"
#include "pdfdocument.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENTTEXTFLOW_H
#define PDFDOCUMENTTEXTFLOW_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2021-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocumenttextfloweditormodel.h"
#include "pdfdocumenttextflow.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENTTEXTFLOWEDITORMODEL_H
#define PDFDOCUMENTTEXTFLOWEDITORMODEL_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfdocumentwriter.h"
#include "pdfconstants.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFDOCUMENTWRITER_H
#define PDFDOCUMENTWRITER_H
@ -34,10 +39,9 @@ class PDF4QTLIBCORESHARED_EXPORT PDFDocumentWriter
Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocumentWriter)
public:
explicit inline PDFDocumentWriter(PDFProgress* progress) :
m_progress(progress)
explicit inline PDFDocumentWriter(PDFProgress* progress)
{
Q_UNUSED(progress);
}
/// Writes document to the file. If \p safeWrite is true, then document is first
@ -76,9 +80,6 @@ private:
static void writeCRLF(QIODevice* device);
static void writeObjectHeader(QIODevice* device, PDFObjectReference reference);
static void writeObjectFooter(QIODevice* device);
/// Progress indicator
PDFProgress* m_progress;
};
} // namespace pdf

View File

@ -1,29 +1,31 @@
// Copyright (C) 2018-2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfencoding.h"
#include "pdfdbgheap.h"
#include <QTimeZone>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QStringDecoder>
#else
#include <QTextCodec>
#endif
#include "pdfdbgheap.h"
#include <cctype>
#include <cstring>
@ -2378,7 +2380,6 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
if (hasUnicodeLeadMarkings(stream))
{
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStringDecoder decoder(QStringDecoder::Utf16BE);
QString text = decoder.decode(stream);
@ -2386,16 +2387,9 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
{
return text;
}
#else
QTextCodec *codec = QTextCodec::codecForName("UTF-16BE");
QString text = codec->toUnicode(stream);
// TODO -- how to detect errors?
return text;
#endif
}
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStringDecoder decoder(QStringDecoder::Utf16LE);
QString text = decoder.decode(stream);
@ -2403,18 +2397,11 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
{
return text;
}
#else
QTextCodec *codec = QTextCodec::codecForName("UTF-16LE");
QString text = codec->toUnicode(stream);
// TODO -- how to detect errors?
return text;
#endif
}
}
if (hasUTF8LeadMarkings(stream))
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStringDecoder decoder(QStringDecoder::Utf8);
QString text = decoder.decode(stream);
@ -2422,12 +2409,6 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
{
return text;
}
#else
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QString text = codec->toUnicode(stream);
// TODO -- how to detect errors?
return text;
#endif
}
if (canConvertFromEncoding(stream, Encoding::PDFDoc))

View File

@ -1,19 +1,24 @@
// Copyright (C) 2018-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFENCODING_H
#define PDFENCODING_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFEXCEPTION_H
#define PDFEXCEPTION_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2023 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfexecutionpolicy.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFEXECUTIONPOLICY_H
#define PDFEXECUTIONPOLICY_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdffile.h"
#include "pdfdocument.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFFILE_H
#define PDFFILE_H

View File

@ -1,20 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFFLATARRAY_H
#define PDFFLATARRAY_H

View File

@ -1,20 +1,24 @@
// Copyright (C) 2018-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFFLATMAP_H
#define PDFFLATMAP_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdffont.h"
#include "pdfdocument.h"
@ -93,6 +98,23 @@ static constexpr std::array S_DEFAULT_CJK_FONTS =
PDF_Default_CJK_Font{ ECjkDefaultFontType::AdobeKorea, true, "Batang" },
};
struct PDF_Font_Replacement
{
const char* origFont;
const char* replaceFont;
};
static constexpr std::array S_FONT_REPLACEMENTS
{
PDF_Font_Replacement{"Futura", "Calibri"},
PDF_Font_Replacement{"Utopia-Bold", "Georgia"},
PDF_Font_Replacement{"Utopia-BoldItalic", "Georgia"},
PDF_Font_Replacement{"Utopia-Italic", "Georgia"},
PDF_Font_Replacement{"Utopia-Semibold", "Georgia"},
PDF_Font_Replacement{"Utopia-SemiboldItalic", "Georgia"},
PDF_Font_Replacement{"Utopia", "Georgia"},
};
/// Storage class for system fonts
class PDFSystemFontInfoStorage
{
@ -250,6 +272,22 @@ QByteArray PDFSystemFontInfoStorage::loadFont(const CIDSystemInfo* cidSystemInfo
}
}
if (fontData.isEmpty())
{
for (const PDF_Font_Replacement& fontReplacement : S_FONT_REPLACEMENTS)
{
if (fontName.contains(QLatin1String(fontReplacement.origFont)))
{
fontData = loadFontImpl(descriptor, QString(fontReplacement.replaceFont), StandardFontType::Invalid, reporter);
if (!fontData.isEmpty())
{
return fontData;
}
}
}
}
return fontData;
}
@ -531,9 +569,10 @@ QString PDFSystemFontInfoStorage::getFontPostscriptName(QString fontName)
return fontName.remove(QChar(' ')).remove(QChar('-')).remove(QChar(',')).trimmed();
}
PDFFont::PDFFont(CIDSystemInfo CIDSystemInfo, FontDescriptor fontDescriptor) :
PDFFont::PDFFont(CIDSystemInfo CIDSystemInfo, QByteArray fontId, FontDescriptor fontDescriptor) :
m_CIDSystemInfo(qMove(CIDSystemInfo)),
m_fontDescriptor(qMove(fontDescriptor))
m_fontDescriptor(qMove(fontDescriptor)),
m_fontId(qMove(fontId))
{
}
@ -716,7 +755,7 @@ void PDFRealizedFontImpl::fillTextSequence(const QByteArray& byteArray, TextSequ
if (glyphIndex)
{
const Glyph& glyph = getGlyph(glyphIndex);
textSequence.items.emplace_back(&glyph.glyph, (*encoding)[static_cast<uint8_t>(byteArray[i])], glyph.advance);
textSequence.items.emplace_back(&glyph.glyph, (*encoding)[static_cast<uint8_t>(byteArray[i])], glyph.advance, static_cast<CID>(byteArray[i]));
}
else
{
@ -724,7 +763,7 @@ void PDFRealizedFontImpl::fillTextSequence(const QByteArray& byteArray, TextSequ
if (glyphWidth > 0)
{
const QPainterPath* nullpath = nullptr;
textSequence.items.emplace_back(nullpath, QChar(), glyphWidth * m_pixelSize * FONT_WIDTH_MULTIPLIER);
textSequence.items.emplace_back(nullpath, QChar(), glyphWidth * m_pixelSize * FONT_WIDTH_MULTIPLIER, static_cast<CID>(byteArray[i]));
}
}
}
@ -751,7 +790,7 @@ void PDFRealizedFontImpl::fillTextSequence(const QByteArray& byteArray, TextSequ
{
QChar character = toUnicode->getToUnicode(cid);
const Glyph& glyph = getGlyph(glyphIndex);
textSequence.items.emplace_back(&glyph.glyph, character, glyph.advance);
textSequence.items.emplace_back(&glyph.glyph, character, glyph.advance, cid);
}
else
{
@ -766,7 +805,7 @@ void PDFRealizedFontImpl::fillTextSequence(const QByteArray& byteArray, TextSequ
// We do not multiply advance with font size and FONT_WIDTH_MULTIPLIER, because in the code,
// "advance" is treated as in font space.
const QPainterPath* nullpath = nullptr;
textSequence.items.emplace_back(nullpath, QChar(), -glyphWidth);
textSequence.items.emplace_back(nullpath, QChar(), -glyphWidth, cid);
}
}
}
@ -1251,7 +1290,53 @@ CIDSystemInfo PDFFont::readCIDSystemInfo(const PDFObject& cidSystemInfoObject, c
return cidSystemInfo;
}
PDFFontPointer PDFFont::createFont(const PDFObject& object, const PDFDocument* document)
QByteArray PDFFont::getFontId() const
{
return m_fontId;
}
PDFEncodedText PDFFont::encodeText(const QString& text) const
{
PDFEncodedText result;
result.isValid = true;
const PDFFontCMap* cmap = getCMap();
const PDFFontCMap* toUnicode = getToUnicode();
if (!cmap || !toUnicode)
{
result.errorString = PDFTranslationContext::tr("Invalid font encoding.");
return result;
}
for (const QChar& character : text)
{
CID cid = toUnicode->getFromUnicode(character);
if (cid != CID())
{
QByteArray encoded = cmap->encode(cid);
if (!encoded.isEmpty())
{
result.encodedText.append(encoded);
result.errorString += "_";
}
else
{
result.isValid = false;
result.errorString += character;
}
}
else
{
result.isValid = false;
result.errorString += character;
}
}
return result;
}
PDFFontPointer PDFFont::createFont(const PDFObject& object, QByteArray fontId, const PDFDocument* document)
{
const PDFObject& dereferencedFontDictionary = document->getObject(object);
if (!dereferencedFontDictionary.isDictionary())
@ -1730,7 +1815,7 @@ PDFFontPointer PDFFont::createFont(const PDFObject& object, const PDFDocument* d
toUnicodeCMap = PDFFontCMap::createFromData(decodedStream);
}
return PDFFontPointer(new PDFType0Font(qMove(cidSystemInfo), qMove(fontDescriptor), qMove(cmap), qMove(toUnicodeCMap), qMove(cidToGidMapper), defaultWidth, qMove(advances)));
return PDFFontPointer(new PDFType0Font(qMove(cidSystemInfo), qMove(fontId), qMove(fontDescriptor), qMove(cmap), qMove(toUnicodeCMap), qMove(cidToGidMapper), defaultWidth, qMove(advances)));
}
case FontType::Type3:
@ -1820,7 +1905,7 @@ PDFFontPointer PDFFont::createFont(const PDFObject& object, const PDFDocument* d
}
std::vector<PDFReal> widthsF3 = fontLoader.readNumberArrayFromDictionary(fontDictionary, "Widths");
return PDFFontPointer(new PDFType3Font(qMove(fontDescriptor), firstCharF3, lastCharF3, fontMatrix, qMove(characterContentStreams), qMove(widthsF3), document->getObject(fontDictionary->get("Resources")), qMove(toUnicodeCMap)));
return PDFFontPointer(new PDFType3Font(qMove(fontDescriptor), qMove(fontId), firstCharF3, lastCharF3, fontMatrix, qMove(characterContentStreams), qMove(widthsF3), document->getObject(fontDictionary->get("Resources")), qMove(toUnicodeCMap)));
}
default:
@ -1834,10 +1919,10 @@ PDFFontPointer PDFFont::createFont(const PDFObject& object, const PDFDocument* d
{
case FontType::Type1:
case FontType::MMType1:
return PDFFontPointer(new PDFType1Font(fontType, qMove(cidSystemInfo), qMove(fontDescriptor), qMove(name), qMove(baseFont), firstChar, lastChar, qMove(widths), encoding, simpleFontEncodingTable, standardFont, glyphIndexArray));
return PDFFontPointer(new PDFType1Font(fontType, qMove(fontId), qMove(cidSystemInfo), qMove(fontDescriptor), qMove(name), qMove(baseFont), firstChar, lastChar, qMove(widths), encoding, simpleFontEncodingTable, standardFont, glyphIndexArray));
case FontType::TrueType:
return PDFFontPointer(new PDFTrueTypeFont(qMove(cidSystemInfo), qMove(fontDescriptor), qMove(name), qMove(baseFont), firstChar, lastChar, qMove(widths), encoding, simpleFontEncodingTable, glyphIndexArray));
return PDFFontPointer(new PDFTrueTypeFont(qMove(cidSystemInfo), qMove(fontId), qMove(fontDescriptor), qMove(name), qMove(baseFont), firstChar, lastChar, qMove(widths), encoding, simpleFontEncodingTable, glyphIndexArray));
default:
{
@ -1850,6 +1935,7 @@ PDFFontPointer PDFFont::createFont(const PDFObject& object, const PDFDocument* d
}
PDFSimpleFont::PDFSimpleFont(CIDSystemInfo cidSystemInfo,
QByteArray fontId,
FontDescriptor fontDescriptor,
QByteArray name,
QByteArray baseFont,
@ -1859,7 +1945,7 @@ PDFSimpleFont::PDFSimpleFont(CIDSystemInfo cidSystemInfo,
PDFEncoding::Encoding encodingType,
encoding::EncodingTable encoding,
GlyphIndices glyphIndices) :
PDFFont(qMove(cidSystemInfo), qMove(fontDescriptor)),
PDFFont(qMove(cidSystemInfo), qMove(fontId), qMove(fontDescriptor)),
m_name(qMove(name)),
m_baseFont(qMove(baseFont)),
m_firstChar(firstChar),
@ -1889,6 +1975,45 @@ PDFInteger PDFSimpleFont::getGlyphAdvance(size_t index) const
return 0;
}
PDFEncodedText PDFSimpleFont::encodeText(const QString& text) const
{
PDFEncodedText result;
result.isValid = true;
const encoding::EncodingTable* encodingTable = getEncoding();
for (const QChar& character : text)
{
ushort unicode = character.unicode();
unsigned char converted = 0;
bool isFound = false;
for (size_t i = 0; i < encodingTable->size(); ++i)
{
if (unicode == (*encodingTable)[static_cast<unsigned char>(i)] &&
m_glyphIndices[i] != GID())
{
isFound = true;
converted = static_cast<unsigned char>(i);
break;
}
}
if (isFound)
{
result.encodedText.append(static_cast<char>(converted));
result.errorString += "_";
}
else
{
result.isValid = false;
result.errorString += character;
}
}
return result;
}
void PDFSimpleFont::dumpFontToTreeItem(ITreeFactory* treeFactory) const
{
BaseClass::dumpFontToTreeItem(treeFactory);
@ -1943,6 +2068,7 @@ void PDFSimpleFont::dumpFontToTreeItem(ITreeFactory* treeFactory) const
}
PDFType1Font::PDFType1Font(FontType fontType,
QByteArray fontId,
CIDSystemInfo cidSystemInfo,
FontDescriptor fontDescriptor,
QByteArray name,
@ -1954,7 +2080,7 @@ PDFType1Font::PDFType1Font(FontType fontType,
encoding::EncodingTable encoding,
StandardFontType standardFontType,
GlyphIndices glyphIndices) :
PDFSimpleFont(qMove(cidSystemInfo), qMove(fontDescriptor), qMove(name), qMove(baseFont), firstChar, lastChar, qMove(widths), encodingType, encoding, glyphIndices),
PDFSimpleFont(qMove(cidSystemInfo), qMove(fontId), qMove(fontDescriptor), qMove(name), qMove(baseFont), firstChar, lastChar, qMove(widths), encodingType, encoding, glyphIndices),
m_fontType(fontType),
m_standardFontType(standardFontType)
{
@ -2035,7 +2161,7 @@ void PDFFontCache::setDocument(const PDFModifiedDocument& document)
}
}
PDFFontPointer PDFFontCache::getFont(const PDFObject& fontObject) const
PDFFontPointer PDFFontCache::getFont(const PDFObject& fontObject, const QByteArray& fontId) const
{
if (fontObject.isReference())
{
@ -2048,7 +2174,7 @@ PDFFontPointer PDFFontCache::getFont(const PDFObject& fontObject) const
if (it == m_fontCache.cend())
{
// We must create the font
PDFFontPointer font = PDFFont::createFont(fontObject, m_document);
PDFFontPointer font = PDFFont::createFont(fontObject, fontId, m_document);
if (m_fontCacheShrinkDisabledObjects.empty() && m_fontCache.size() >= m_fontCacheLimit)
{
@ -2063,7 +2189,7 @@ PDFFontPointer PDFFontCache::getFont(const PDFObject& fontObject) const
else
{
// Object is not a reference. Create font directly and return it.
return PDFFont::createFont(fontObject, m_document);
return PDFFont::createFont(fontObject, fontId, m_document);
}
}
@ -2455,6 +2581,35 @@ std::vector<CID> PDFFontCMap::interpret(const QByteArray& byteArray) const
return result;
}
QByteArray PDFFontCMap::encode(CID cid) const
{
QByteArray byteArray;
for (const auto& entry : m_entries)
{
unsigned int minPossibleValue = entry.from + entry.cid;
unsigned int maxPossibleValue = entry.to + entry.cid;
if (cid >= minPossibleValue && cid <= maxPossibleValue)
{
// Calculate the original value from cid
unsigned int value = cid - entry.cid + entry.from;
byteArray.reserve(entry.byteCount);
// Construct byte array for this value based on the entry's byteCount
for (int i = entry.byteCount - 1; i >= 0; --i)
{
byteArray.append(static_cast<char>((value >> (8 * i)) & 0xFF));
}
break;
}
}
return byteArray;
}
QChar PDFFontCMap::getToUnicode(CID cid) const
{
if (isValid())
@ -2471,6 +2626,29 @@ QChar PDFFontCMap::getToUnicode(CID cid) const
return QChar();
}
CID PDFFontCMap::getFromUnicode(QChar character) const
{
if (!character.isNull())
{
char16_t ucs4 = character.unicode();
const CID unicodeCID = ucs4;
for (const Entry& entry : m_entries)
{
const CID minUnicodeCID = entry.cid;
const CID maxUnicodeCID = (entry.to - entry.from) + entry.cid;
if (unicodeCID >= minUnicodeCID && unicodeCID <= maxUnicodeCID)
{
const CID cid = unicodeCID + entry.from - entry.cid;
return cid;
}
}
}
return CID();
}
PDFFontCMap::PDFFontCMap(Entries&& entries, bool vertical) :
m_entries(qMove(entries)),
m_maxKeyLength(0),
@ -2578,6 +2756,7 @@ PDFReal PDFType0Font::getGlyphAdvance(CID cid) const
}
PDFType3Font::PDFType3Font(FontDescriptor fontDescriptor,
QByteArray fontId,
int firstCharacterIndex,
int lastCharacterIndex,
QTransform fontMatrix,
@ -2585,7 +2764,7 @@ PDFType3Font::PDFType3Font(FontDescriptor fontDescriptor,
std::vector<double>&& widths,
const PDFObject& resources,
PDFFontCMap toUnicode) :
PDFFont(CIDSystemInfo(), qMove(fontDescriptor)),
PDFFont(CIDSystemInfo(), qMove(fontId), qMove(fontDescriptor)),
m_firstCharacterIndex(firstCharacterIndex),
m_lastCharacterIndex(lastCharacterIndex),
m_fontMatrix(fontMatrix),
@ -2647,7 +2826,7 @@ void PDFRealizedType3FontImpl::fillTextSequence(const QByteArray& byteArray, Tex
if (contentStream)
{
textSequence.items.emplace_back(contentStream, character, width);
textSequence.items.emplace_back(contentStream, character, width, index);
}
else
{
@ -2685,4 +2864,16 @@ CharacterInfos PDFRealizedType3FontImpl::getCharacterInfos() const
return result;
}
QByteArray PDFSystemFont::getFontData(const QByteArray& fontName)
{
const PDFSystemFontInfoStorage* storage = PDFSystemFontInfoStorage::getInstance();
CIDSystemInfo systemInfo;
PDFRenderErrorReporterDummy reporter;
FontDescriptor descriptor;
descriptor.fontName = fontName;
return storage->loadFont(&systemInfo, &descriptor, StandardFontType::Invalid, &reporter);
}
} // namespace pdf

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFFONT_H
#define PDFFONT_H
@ -70,9 +75,9 @@ public:
struct TextSequenceItem
{
inline explicit TextSequenceItem() = default;
inline explicit TextSequenceItem(const QPainterPath* glyph, QChar character, PDFReal advance) : glyph(glyph), character(character), advance(advance) { }
inline explicit TextSequenceItem(const QPainterPath* glyph, QChar character, PDFReal advance, CID cid) : glyph(glyph), character(character), advance(advance), cid(cid) { }
inline explicit TextSequenceItem(PDFReal advance) : character(), advance(advance) { }
inline explicit TextSequenceItem(const QByteArray* characterContentStream, QChar character, PDFReal advance) : characterContentStream(characterContentStream), character(character), advance(advance) { }
inline explicit TextSequenceItem(const QByteArray* characterContentStream, QChar character, PDFReal advance, uint cid) : characterContentStream(characterContentStream), character(character), advance(advance), cid(cid) { }
inline bool isContentStream() const { return characterContentStream; }
inline bool isCharacter() const { return glyph; }
@ -83,6 +88,7 @@ struct TextSequenceItem
const QByteArray* characterContentStream = nullptr;
QChar character;
PDFReal advance = 0;
CID cid = 0;
};
struct TextSequence
@ -290,11 +296,18 @@ private:
IRealizedFontImpl* m_impl;
};
struct PDFEncodedText
{
QByteArray encodedText;
QString errorString;
bool isValid = false;
};
/// Base class representing font in the PDF file
class PDF4QTLIBCORESHARED_EXPORT PDFFont
{
public:
explicit PDFFont(CIDSystemInfo CIDSystemInfo, FontDescriptor fontDescriptor);
explicit PDFFont(CIDSystemInfo CIDSystemInfo, QByteArray fontId, FontDescriptor fontDescriptor);
virtual ~PDFFont() = default;
/// Returns the font type
@ -317,8 +330,9 @@ public:
/// Creates font from the object. If font can't be created, exception is thrown.
/// \param object Font dictionary
/// \param fontId Font ID
/// \param document Document
static PDFFontPointer createFont(const PDFObject& object, const PDFDocument* document);
static PDFFontPointer createFont(const PDFObject& object, QByteArray fontId, const PDFDocument* document);
/// Tries to read font descriptor from the object
/// \param fontDescriptorObject Font descriptor dictionary
@ -330,9 +344,16 @@ public:
/// \param document Document
static CIDSystemInfo readCIDSystemInfo(const PDFObject& cidSystemInfoObject, const PDFDocument* document);
/// Returns font id from the font dictionary
QByteArray getFontId() const;
/// Encodes text into font encoding
virtual PDFEncodedText encodeText(const QString& text) const;
protected:
CIDSystemInfo m_CIDSystemInfo;
FontDescriptor m_fontDescriptor;
QByteArray m_fontId;
};
/// Simple font, see PDF reference 1.7, chapter 5.5. Simple fonts have encoding table,
@ -343,6 +364,7 @@ class PDFSimpleFont : public PDFFont
public:
explicit PDFSimpleFont(CIDSystemInfo cidSystemInfo,
QByteArray fontId,
FontDescriptor fontDescriptor,
QByteArray name,
QByteArray baseFont,
@ -361,6 +383,8 @@ public:
/// Returns the glyph advance (or zero, if glyph advance is invalid)
PDFInteger getGlyphAdvance(size_t index) const;
virtual PDFEncodedText encodeText(const QString& text) const override;
virtual void dumpFontToTreeItem(ITreeFactory* treeFactory) const override;
protected:
@ -380,6 +404,7 @@ class PDFType1Font : public PDFSimpleFont
public:
explicit PDFType1Font(FontType fontType,
QByteArray fontId,
CIDSystemInfo cidSystemInfo,
FontDescriptor fontDescriptor,
QByteArray name,
@ -433,7 +458,8 @@ public:
/// Retrieves font from the cache. If font can't be accessed or created,
/// then exception is thrown.
/// \param fontObject Font object
PDFFontPointer getFont(const PDFObject& fontObject) const;
/// \param fontId Font identification in resource dictionary
PDFFontPointer getFont(const PDFObject& fontObject, const QByteArray& fontId) const;
/// Retrieves realized font from the cache. If realized font can't be accessed or created,
/// then exception is thrown.
@ -547,9 +573,15 @@ public:
/// Converts byte array to array of CIDs
std::vector<CID> interpret(const QByteArray& byteArray) const;
/// Encodes character to byte array
QByteArray encode(CID cid) const;
/// Converts CID to QChar, use only on ToUnicode CMaps
QChar getToUnicode(CID cid) const;
/// Converts QChar to CID, use only on ToUnicode CMaps
CID getFromUnicode(QChar character) const;
private:
struct Entry
@ -599,6 +631,7 @@ class PDFType3Font : public PDFFont
{
public:
explicit PDFType3Font(FontDescriptor fontDescriptor,
QByteArray fontId,
int firstCharacterIndex,
int lastCharacterIndex,
QTransform fontMatrix,
@ -640,8 +673,15 @@ private:
class PDFType0Font : public PDFFont
{
public:
explicit inline PDFType0Font(CIDSystemInfo cidSystemInfo, FontDescriptor fontDescriptor, PDFFontCMap cmap, PDFFontCMap toUnicode, PDFCIDtoGIDMapper mapper, PDFReal defaultAdvance, std::unordered_map<CID, PDFReal> advances) :
PDFFont(qMove(cidSystemInfo), qMove(fontDescriptor)),
explicit inline PDFType0Font(CIDSystemInfo cidSystemInfo,
QByteArray fontId,
FontDescriptor fontDescriptor,
PDFFontCMap cmap,
PDFFontCMap toUnicode,
PDFCIDtoGIDMapper mapper,
PDFReal defaultAdvance,
std::unordered_map<CID, PDFReal> advances) :
PDFFont(qMove(cidSystemInfo), qMove(fontId), qMove(fontDescriptor)),
m_cmap(qMove(cmap)),
m_toUnicode(qMove(toUnicode)),
m_mapper(qMove(mapper)),
@ -698,6 +738,12 @@ private:
std::map<QByteArray, QByteArray> m_cmaps;
};
class PDF4QTLIBCORESHARED_EXPORT PDFSystemFont
{
public:
static QByteArray getFontData(const QByteArray& fontName);
};
} // namespace pdf
#endif // PDFFONT_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdfform.h"
#include "pdfdocument.h"

View File

@ -1,19 +1,24 @@
// Copyright (C) 2020-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFFORM_H
#define PDFFORM_H

View File

@ -1,19 +1,24 @@
// Copyright (C) 2019-2022 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "pdffunction.h"
#include "pdfflatarray.h"

View File

@ -1,20 +1,24 @@
// Copyright (C) 2019-2021 Jakub Melka
// MIT License
//
// This file is part of PDF4QT.
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFFUNCTION_H
#define PDFFUNCTION_H

Some files were not shown because too many files have changed in this diff Show More