FynPDF
FynPDF
Built from scratch with a custom PDF engine. No third-party SDKs.
Engine Architecture
A layered, modular PDF engine built from the ground up against ISO 32000-1:2008 (PDF 1.7 spec). No PDFKit. No shortcuts.
Core Object Model
Complete PDF object graph — booleans, numbers, strings, names, arrays, dictionaries, streams, and indirect references with full resolution.
Parser Pipeline
Byte-level tokenizer, object parser, cross-reference table/stream handler, and document structure reader. Handles incremental updates and hybrid xref files.
Renderer
Content stream interpreter with full graphics state machine. Core Graphics for 2D drawing, Metal for GPU-accelerated mesh shadings and compositing.
Font Engine
Standard 14 fonts, embedded TrueType, CFF/Type1C, CIDFontType0, Type 3 glyph programs, composite CMap fonts, and vertical writing support.
Color System
Device, calibrated, ICC, indexed, separation, DeviceN color spaces. Tiling patterns, axial/radial shadings, and GPU-rendered Coons/tensor patch meshes.
Image Handling
Raw samples, JPEG, JPEG 2000, inline images, stencil masks, soft masks, and color-key masking with full filter pipeline decompression.
What Makes It Different
Every byte of the PDF engine is written from scratch — spec-compliant, modular, and built to last.
Custom PDF Engine
No PDFKit, no third-party SDKs. A ground-up implementation of the PDF 1.7 spec using only Core Graphics, Core Text, and Metal.
Metal-Accelerated Rendering
GPU-powered mesh shading pipeline for Coons patches, tensor-product patches, and Gouraud-interpolated triangle meshes.
Cross-Platform
One shared Swift engine powering both macOS and iPad, with a native SwiftUI interface tailored for each platform.
Spec-Compliant
Every feature verified against ISO 32000-1:2008. From cross-reference streams to CFF font programs — no guesswork.
Built Natively for Apple Platforms
FynPDF is a pure SwiftUI app backed by a modular Swift Package engine. No Electron, no web views, no cross-platform compromises. Core Graphics maps 1:1 to the PDF imaging model, and Metal handles what the GPU does best.
Development Roadmap
FynPDF is being built in incremental phases. Each phase produces a testable, usable artifact before moving to the next.
Phase 0 — Foundation
Project structure, architecture documentation, Swift Package scaffolding, module dependency graph, and searchable PDF 1.7 spec.
Phase 1 — PDF Parser
Complete parser pipeline: tokenizer, object parser, stream filters (Flate, ASCII85, LZW, RunLength), cross-reference tables/streams, document structure reader, and the fynpdf-inspect CLI tool.
Phase 2A–2D — Graphics Fundamentals
Content stream operator parser, graphics state machine (save/restore, CTM, colors, line styles, text state), path rendering (move, line, curve, rect, clip), and basic Device RGB/Gray/CMYK color spaces.
Phase 2E — Image Rendering
XObject images, inline images, JPEG/JPEG 2000 decode, image masks, soft masks, color-key masking, and the fynpdf-render CLI tool for page-to-PNG export.
Phase 2F–2G — Text & Form XObjects
Full text rendering with Standard 14 fonts, embedded TrueType, multiple encodings, all text operators (Tj, TJ, Td, Tm, etc.), and recursive Form XObject content stream interpretation.
Phase 2H — Advanced Color & Patterns
ICCBased, Indexed, CalRGB, CalGray, Lab, Separation, DeviceN color spaces. PDF functions (sampled, exponential, stitching, PostScript). Tiling patterns, axial/radial shadings, function-based shadings.
Phase 2H-c — Metal Mesh Shadings
GPU-accelerated rendering of free-form triangle meshes (type 4), lattice meshes (type 5), Coons patch meshes (type 6), and tensor-product patch meshes (type 7) via custom Metal vertex/fragment shaders.
Phase 2I — Advanced Fonts
Composite Type 0 fonts with CMap parsing, CIDFont descendants, ToUnicode mappings, CFF/Type1C font programs, dynamic uniXXXX glyph resolution, Type 3 glyph programs, vertical writing, and text clip modes.
Phase 2J-a/b — Logging & CLI Polish
Per-module structured logging via swift-log, and fynpdf-render enhancements: page ranges, batch mode, timing output, verbose/quiet flags, and render summaries.
Phase 2J-c — Enhanced CLI Subcommands
New fonts, operators subcommands for fynpdf-inspect. Enhanced output for shading, pattern, and color space details. Object resolution with --resolve flag.
Phase 2J-d — Visual Diff
Pixel comparison against reference PNGs with diff image output and difference percentage reporting for regression testing.
Phase 3 — Viewer UI
Document-based SwiftUI app with continuous page scrolling, pinch-to-zoom, thumbnail sidebar, page navigation, keyboard shortcuts, and background rendering pipeline.
Phase 4 — Text Layer
Text extraction from content streams, text selection with drag, copy to clipboard, and full-document search with match navigation.
Phase 5–6 — Annotations
Read and display all annotation types (highlights, links, ink, stamps, notes), then create, edit, and delete annotations with Apple Pencil support on iPad.
Phase 7 — Writer
Incremental save, full document rewrite, page manipulation (add, delete, reorder, rotate), and cross-reference generation.
Phase 8 — Forms
AcroForm parsing, text fields, checkboxes, dropdowns, radio buttons, field validation, form flattening, and filled form saving.
Phase 9 — Security
Password-protected PDF support with RC4 and AES (128/256-bit) decryption, permission enforcement, and encryption on save.
Phase 10 — Polish & Performance
Transparency/blending, display list IR, tiled rendering, Metal compositing, Apple Pencil low-latency ink, dark mode, bookmarks, and platform-specific refinements.
Target Platforms
- macOS: 14.0 (Sonoma) or later
- iOS/iPadOS: 17.0 or later
- Processor: Apple Silicon (optimized)
- GPU: Metal-capable device
Building a better PDF experience
FynPDF is being built one spec-compliant phase at a time.
Stay tuned for updates as development progresses.