thoven87/poppler-kit
Swift 6 PDF library for macOS and Linux, built on Poppler.
Products
| Product | API | System dependency | |---|---|---| | PopplerKit | In-process C++ binding — text, metadata, rendering, table extraction | libpoppler-cpp | | PopplerUtils | Subprocess wrappers for poppler-utils CLI — split, merge, SVG, signing | poppler-utils |
Install
// Package.swift
.package(url: "https://github.com/thoven87/poppler-kit", from: "1.0.0")# macOS — both are required: pkg-config is used by SPM to resolve poppler-cpp headers
brew install pkg-config poppler
# Linux / Docker — poppler 26.05.0 must be built from source (Ubuntu 24.04 provides deps)
# See the DocC GettingStarted guide or the CI workflows for the exact cmake invocation.Quick start
import PopplerKit
let doc = try PopplerDocument.load(from: url)
// Text-layer PDF → stream text
if doc.hasExtractableText {
for try await pageText in doc.textStream() { process(pageText) }
}
// Scanned PDF → stream base64 images for LLM inference
else {
for try await b64 in doc.rasterBase64Stream(xres: 150) {
try await llm.analyse(image: b64)
}
}Documentation
Full API reference and guides are in the DocC documentation:
swift package generate-documentation --target PopplerKit
swift package generate-documentation --target PopplerUtilsGuides
- Getting Started — installation, loading, first extraction
- Text Extraction —
textStream,textBoxes, region extraction, search - Rasterization — rendering pipeline, LLM integration, resolution guide
- Working with Documents — metadata, security, permissions, structure, saving
- Table Extraction —
PDFTable, keyword selection, multi-page tables - Docker and Cloud Run — container setup, Cloud Run config, Ubuntu compatibility
Package Metadata
Repository: thoven87/poppler-kit
Default branch: main
README: README.md