Vanilla.PDF is a modern, high-performance, open-source C++17 SDK for creating, editing, signing, and analyzing PDF documents. With no external runtime dependencies and full cross-platform support, it's ideal for embedding into desktop, server, or automation workflows.
- π Create & modify PDF documents β pages, text, images, vector graphics
- π Sign & verify digital signatures (CMS/PKCS#7) with certificate chain validation
- π Encrypt & decrypt with AES or RC4 using passwords or certificates
- βοΈ ABI-stable C API β opaque handles callable from any language with a C FFI
- π§΅ Thread-safe β no global state; synchronization is handled internally
vcpkg install vanillapdfinclude(FetchContent)
FetchContent_Declare(vanillapdf
GIT_REPOSITORY https://github.com/vanillapdf/vanillapdf.git
GIT_TAG main)
FetchContent_MakeAvailable(vanillapdf)
target_link_libraries(myapp PRIVATE vanillapdf::vanillapdf)- NuGet (.NET interop) β
dotnet add package vanillapdf.net - Conan π§ β coming soon (not yet published to Conan Center)
- Homebrew (macOS) π§ β coming soon (formula not yet live in Homebrew core)
- Build from source β clone with submodules, then configure with a CMake preset
See the installation guide and building from source on Read the Docs for full instructions.
Create a PDF with a blank page:
#include <vanillapdf/c_vanillapdf_api.h>
int main(void) {
DocumentHandle* doc = NULL;
CatalogHandle* cat = NULL;
PageTreeHandle* pages = NULL;
PageObjectHandle* page = NULL;
Document_Create("hello.pdf", &doc);
Document_GetCatalog(doc, &cat);
Catalog_GetPages(cat, &pages);
PageObject_CreateFromDocument(doc, &page);
PageTree_AppendPage(pages, page);
Document_Save(doc, "hello.pdf");
PageObject_Release(page);
PageTree_Release(pages);
Catalog_Release(cat);
Document_Release(doc);
return 0;
}| Platform | Compilers | Architectures |
|---|---|---|
| Windows | Visual Studio 2022, 2026 | x86, x64, ARM64 |
| Linux | GCC 8.1+, Clang 10+ | x64, ARM64, ARM |
| macOS | AppleClang 15+ (Xcode 15) | x64, ARM64 |
| Android | NDK toolchain | arm64, armv7, x86, x86_64 |
| Feature | C API | Description |
|---|---|---|
| Create documents | Document_Create |
Pages, text, images, vector paths |
| Digital signatures | Document_Sign |
OpenSSL CMS β RSA, ECDSA (P-256/P-384/P-521), Ed25519, Ed448 via PKCS#12 keys or custom callbacks |
| Signature verification | DigitalSignatureExtensions_Verify |
Chain validation, weak-algorithm detection, signing-time checks |
| File structure validation | FileStructureValidator_* |
Walk xref/trailers/streams and report malformed files |
| Interactive forms | FormField_GetValue / _SetValue |
Read/write AcroForm field values |
| Encryption | Document_AddEncryption / _RemoveEncryption |
AES and RC4, owner/user passwords, certificate-based decryption (FIPS-compatible) |
| Content streams | ContentStream_* |
Parse and encode PostScript-style page content |
| Low-level parsing | File_Open |
XRef tables, indirect objects, cross-reference streams |
A
vanillapdf-toolscommand-line utility is built from source (not yet distributed as a standalone app) and exposessign,verify,merge,extract,encrypt/decrypt, and more β see CLI Tools on Read the Docs.
The library is organized into three layers:
- Syntax β PDF object types, tokenizer, parser, XRef tables, compression filters
- Semantics β Documents, pages, catalogs, annotations, digital signatures, forms
- Contents β Content stream parsing, PostScript instruction processing
The C++ core is hidden behind an ABI-stable ANSI C interface using opaque handles (DocumentHandle*, FileHandle*, PageObjectHandle*, etc.) and cdecl calling conventions, so any language with a C FFI can use this library. Handles are reference-counted; callers acquire and release references explicitly. This design guarantees binary compatibility across compiler versions and minor/patch releases.
Vanilla.PDF provides fine-grained thread safety: the same object can be accessed concurrently from multiple threads β including objects that initialize lazily on first access β without any caller-side locking. This is a stronger guarantee than merely running separate documents on separate threads; synchronization within a shared object is handled internally.
See the Architecture Guide for the memory and locking model.
Vanilla.PDF is a document structure library, not a rendering engine. It does not rasterize pages, lay out text with font shaping, or display PDFs on screen. If you need to view a PDF, use a dedicated renderer and this library for the structural operations around it.
Current known limitations:
- No PDF rendering or rasterization
- No CRL/OCSP revocation checking (#157)
- No PAdES compliance levels (BES, T, LTV)
- No RFC 3161 timestamp validation
Vanilla.PDF follows Semantic Versioning. The C API is stable within a major version: minor releases add functionality without breaking existing callers, patch releases contain only fixes. Query the version at runtime with LibraryInfo_GetVersionMajor, LibraryInfo_GetVersionMinor, LibraryInfo_GetVersionPatch.
Full documentation is hosted on Read the Docs.
| Guide | Description |
|---|---|
| Overview | Design philosophy, scope, and project goals |
| Quickstart | Create your first PDF document step by step |
| Installation | vcpkg, FetchContent, Conan, Homebrew, NuGet |
| C API Guide | Handles, memory management, error handling |
| Architecture | Three-layer design, object model, memory model, thread safety |
| CLI Tools | sign, verify, merge, extract, encrypt, decrypt |
| Signature Verification | Trust stores, chain validation, weak-algorithm detection |
| Building | Build from source with CMake presets |
| Examples | Code samples for signing, merging, encryption |
| PDF Format | PDF syntax, objects, and document structure |
See the Changelog for release notes.
We welcome pull requests, feature proposals, and bug reports.
All changes require a branch and pull request. The main and release/* branches are protected.
Vanilla.PDF is licensed under the Apache 2.0 License.
| Channel | Link |
|---|---|
| info@vanillapdf.com | |
| Website | vanillapdf.com |
| Issues | GitHub Issues |
| Sponsor | GitHub Sponsors |