https://github.com/thoven87/poppler-kit
High performant Swift wrapper for the Poppler PDF rendering utilities
https://github.com/thoven87/poppler-kit
cairo converter html pdf pdf-converter pdf-to-cairo pdf-to-html pdf-to-image pdf-to-text poppler poppler-utils ppm ps server-side-swift sign-pdf swift swift-on-server text unite
Last synced: 21 days ago
JSON representation
High performant Swift wrapper for the Poppler PDF rendering utilities
- Host: GitHub
- URL: https://github.com/thoven87/poppler-kit
- Owner: thoven87
- License: gpl-3.0
- Created: 2026-05-19T18:16:03.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-27T02:43:18.000Z (about 1 month ago)
- Last Synced: 2026-05-27T04:27:21.893Z (about 1 month ago)
- Topics: cairo, converter, html, pdf, pdf-converter, pdf-to-cairo, pdf-to-html, pdf-to-image, pdf-to-text, poppler, poppler-utils, ppm, ps, server-side-swift, sign-pdf, swift, swift-on-server, text, unite
- Language: Swift
- Homepage:
- Size: 295 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PopplerKit
Swift 6 PDF library for macOS and Linux, built on [Poppler](https://poppler.freedesktop.org/).
[](https://swift.org)
[](https://swift.org/server)
## 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
```swift
// Package.swift
.package(url: "https://github.com/thoven87/poppler-kit", from: "1.0.0")
```
```bash
# 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
```swift
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**:
```bash
swift package generate-documentation --target PopplerKit
swift package generate-documentation --target PopplerUtils
```
### Guides
- **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