![]() |
Vanilla.PDF
2.2.0
Cross-platform toolkit for creating and modifying PDF documents
|
This comprehensive guide covers how to obtain, build, and configure Vanilla.PDF for all supported platforms and use cases.
The fastest way to get started is using vcpkg:
After installation point CMake at your vcpkg instance:
Benefits include fastest builds with pre-compiled binaries, feature control via vcpkg install vanillapdf[openssl,jpeg,jpeg2000], and shared binary cache across projects.
For users who prefer not to introduce external tools into their build chain, use CMake's FetchContent mechanism:
apt-get install libssl-dev libjpeg-turbo8-dev on Linux, brew install openssl libjpeg-turbo on macOS) or other packaging systems like Conan.A complete working example with cross-platform testing is available in the FetchContent integration example with automated CI validation.
CMake (minimum version 3.20) Download from https://cmake.org/download/
Supported Compilers:
Clone the repository and initialize the bundled vcpkg submodule:
List the available build presets:
Common presets include:
windows-x64-msvc-17 / windows-x86-msvc-17 - Windows with Visual Studio 2022 (dynamic CRT)windows-x64-msvc-17-static / windows-x86-msvc-17-static - Windows with Visual Studio 2022 (static CRT)windows-x64-msvc-17-static-md / windows-x86-msvc-17-static-md - Windows with Visual Studio 2022 (static libs, dynamic CRT)windows-x64-msvc-18 / windows-x86-msvc-18 - Windows with Visual Studio 2026 (dynamic CRT)windows-x64-msvc-18-static / windows-x86-msvc-18-static - Windows with Visual Studio 2026 (static CRT)windows-x64-msvc-18-static-md / windows-x86-msvc-18-static-md - Windows with Visual Studio 2026 (static libs, dynamic CRT)linux-x64-gcc / linux-arm64-gcc - Linux with GCClinux-x64-clang / linux-arm64-clang - Linux with Clangmacos-x64 / macos-arm64 - macOS buildsChoose a preset matching your toolchain:
Windows Build Notes:**
-static variants use static CRT (VANILLAPDF_USE_STATIC_CRT=ON)x64-windows-static-md for static libs + dynamic CRT)For external dependencies** (optional, faster builds):
For external dependencies** (optional, faster builds):
Vanilla.PDF uses vcpkg for automatic dependency management. Dependencies are handled automatically - no manual installation required.
Automatic Dependencies:**
You may manage vcpkg yourself and install the required packages manually:
Configure Vanilla.PDF with the vcpkg toolchain:
If dependencies are managed externally (e.g., by system packages, Conan, or a parent project's vcpkg), disable internal vcpkg entirely:
Alternatively, if you want to use internal vcpkg but override specific libraries to come from your package manager, enable the matching VANILLAPDF_EXTERNAL_* options:
Options exist for OpenSSL, libjpeg-turbo, openjpeg, zlib, spdlog, nlohmann-json, GTest and Google Benchmark. When VANILLAPDF_EXTERNAL_* options are set, the corresponding packages will not be installed by vcpkg and CMake will search for them on your system instead.
-DVANILLAPDF_ENABLE_ENCRYPTION=ON/OFF - PDF encryption/decryption support (default: ON)-DVANILLAPDF_ENABLE_JPEG=ON/OFF - JPEG image support (default: ON)-DVANILLAPDF_ENABLE_JPEG2000=ON/OFF - JPEG2000 support (default: ON)-DVANILLAPDF_INTERNAL_VCPKG=ON/OFF - Enable internal vcpkg dependency management (default: ON)-DVANILLAPDF_ENABLE_PACKAGING=ON/OFF - Enable packaging features like CPack (auto-detected)-DVANILLAPDF_ENABLE_TESTS=ON/OFF - Build and run test scenarios (default: ON)-DVANILLAPDF_ENABLE_BENCHMARK=ON/OFF - Include benchmarking project (default: ON)-DVANILLAPDF_USE_STATIC_CRT=ON/OFF - Use static MSVC runtime (/MT) instead of dynamic (/MD) (default: OFF)-DBUILD_SHARED_LIBS=ON/OFF - Build vanillapdf as a shared library (default: ON)-DVANILLAPDF_ENABLE_COVERAGE=ON - Enable code coverage instrumentation (GCC/Clang only)-DVANILLAPDF_FORCE_32_BIT=ON - Force 32-bit output binary regardless of architecture-DVANILLAPDF_ENABLE_STACK_SANITIZER=ON - Enable address sanitizer for memory safety testing-DVANILLAPDF_EXTERNAL_OPENSSL=ON/OFF - Use system OpenSSL instead of vcpkg (default: OFF)-DVANILLAPDF_EXTERNAL_JPEG=ON/OFF - Use system libjpeg instead of vcpkg (default: OFF)-DVANILLAPDF_EXTERNAL_OPENJPEG=ON/OFF - Use system OpenJPEG instead of vcpkg (default: OFF)-DVANILLAPDF_EXTERNAL_ZLIB=ON/OFF - Use system zlib instead of vcpkg (default: OFF)-DVANILLAPDF_EXTERNAL_SPDLOG=ON/OFF - Use system spdlog instead of vcpkg (default: OFF)-DVANILLAPDF_EXTERNAL_NLOHMANN_JSON=ON/OFF - Use system nlohmann-json instead of vcpkg (default: OFF)After building, run the test suite:
Test Categories:**
Common Issues:**
vcpkg bootstrap fails:*
Build configuration fails:*
Platform-specific dependency issues:*
sudo apt-get install libssl-dev libjpeg-turbo8-dev zlib1g-dev libopenjp2-7-devbrew install openssl@3 jpeg-turbo zlib openjpegInstructions for creating Debian or Homebrew packages are provided in the packaging guide.