This is my entry for november contest:
Xojo FPDF - Pure Xojo PDF Generation with Full Unicode Support
Why Another PDF Library?
If you’ve ever tried to generate PDFs in Xojo with extensive Unicode text (Chinese, Arabic, Hebrew, Mathematical symbols, etc.), you know the challenges. While Xojo’s built-in PDFDocument class works across platforms, it has significant limitations:
ANSI Encoding Only - No true Unicode support, special characters and CJK languages don’t work properly
No Font Subsetting - Embeds entire 20MB font files instead of just the glyphs you use (massive file sizes)
Closed Source - Can’t inspect internals, fix bugs, or extend functionality yourself
Limited Extensibility - Harder to customize for advanced PDF features
Xojo FPDF changes everything. 
What Makes Xojo FPDF Special?
Full Unicode Support
// Japanese, Arabic, Hebrew, Mathematical symbols - ALL WORKING!
pdf.AddUTF8Font("Arial", "", "/path/to/ArialUnicode.ttf")
pdf.SetFont("Arial", "", 14)
pdf.Cell(0, 10, "Hello World! 你好世界! مرحبا بالعالم! שלום עולם!")
Automatic Font Subsetting
Massive file size savings! Our TrueType font subsetter embeds only the glyphs you actually use:
98% size reduction - 20MB Arial Unicode → 400KB subset
Sparse glyph IDs - Preserves original character encoding
Automatic - Happens transparently during font embedding
Smaller PDFs - Perfect for web delivery and email
Xojo’s PDFDocument embeds entire font files, bloating your PDFs unnecessarily.
100% Open Source & Pure Xojo
- No black boxes - Read and modify every line of code
- No declares - Works everywhere (Desktop, Web, iOS, Console)
- Community-driven - Contribute features, fix bugs, adapt to your needs
- Based on proven libraries: go-pdf/fpdf and original PHP FPDF
Cross-Platform by Design
One codebase, four platforms:
Desktop (Mac/Windows/Linux)
Web (Server-side generation)
iOS (Native mobile PDFs)
Console (Automated workflows)
90%+ shared code across all platforms!
Current Feature Set (v0.3.0)
Core Features
UTF-8/Unicode - TrueType font support with full Unicode
Multiple Page Formats - A3, A4, A5, Letter, Legal, Custom sizes
Text Methods - Cell, MultiCell, Write, Text with alignment
Graphics Primitives - Line, Rect, Circle, Ellipse, Arc, Bezier curves, Arrows, Polygons
Image Support - JPEG, PNG (RGB/Grayscale/CMYK), programmatic graphics
Colors - RGB for text, fill, and draw operations
Compression - FlateDecode/zlib (27-60% file size reduction, Desktop/Web/Console)
Links & Bookmarks - Internal links, external URLs, hierarchical outlines
Header/Footer Callbacks - Automatic page headers and footers
Metadata - Title, Author, Subject, Keywords, Creator, Language
PDF/A Compliance - ICC color profiles for archival documents
Advanced Features
Document Encryption - RC4-40 encryption with password protection (free version)
PDF Permissions - Print, copy, modify restrictions (free version with RC4-40)
Custom Page Formats - Define any page dimensions
Printf-Style Formatting - Cellf(), Writef() with %s/%d/%f
Font Metrics - GetFontDesc() for precise typography
Error Accumulation - Go-style error handling (Ok/Err/GetError)
19 Working Examples
Every feature has a working example that generates a real PDF:
- Simple Shapes - Lines, rectangles, circles, Bezier curves, arrows
- Text Layouts - Cell, MultiCell, Write with alignment
- Multiple Pages - Multi-page documents with various shapes
- Line Widths - Different line styles, caps, joins
- UTF-8 & TrueType Fonts - Chinese, Arabic, Hebrew, Mathematical symbols
- Text Measurement - Precise alignment with GetStringWidth()
- Document Metadata - Title, Author, Subject, Keywords
- Error Handling - Ok(), Err(), GetError() patterns
- Image Support - JPEG, PNG files, programmatically drawn graphics
- Header/Footer Callbacks - Automatic headers with page count
- Links and Bookmarks - TOC, clickable links, PDF outline
- Custom Page Formats - Mixed page sizes in one document
- PDF/A Compliance - ICC color profiles for archival
- Document Encryption - RC4-40 password protection and permissions (free version)
- Watermark Header - Semi-transparent background watermarks
- Formatting Features - Printf-style formatters, font metrics
- Utility Methods - Version info, unit conversions, page size helpers
- Plugin Architecture - Premium feature separation
- Table Generation - Professional tables with pagination
All examples generate PDFs you can inspect in pdf_examples/ folder!
Premium Modules - Coming Soon
Premium modules are ready! We’re finalizing the distribution and licensing system:
Encryption Premium (Ready)
Free version includes RC4-40 encryption + permissions. Premium adds:
AES-256 - Strongest PDF encryption available (Revisions 5-6)
AES-128 - Modern encryption without Acrobat warnings (Revision 4) - RECOMMENDED
RC4-128 - Enhanced legacy support (Revision 3)
All encryption levels work with full permission control (print, copy, modify restrictions)
Table Premium (Ready)
SimpleTable - Quick equal-width columns
ImprovedTable - Custom widths, auto number alignment
FancyTable - Styled headers, alternating rows
Multi-Page Tables - Auto page breaks with header repetition
Database Integration - Direct RowSet support from SQLite/PostgreSQL/etc
Compression Premium (Ready)
Free version uses system zlib with Declares (Desktop/Web/Console only, iOS blocked)
Premium is 100% pure Xojo code - no declares, works everywhere:
Pure Xojo Zlib - Complete DEFLATE/INFLATE implementation in Xojo
iOS Support - Works on iOS where system zlib is blocked by sandboxing
60% Smaller PDFs - FlateDecode compression on all platforms
No Dependencies - No system libraries, no declares, fully portable
PDF/A Premium (Planned)
- Advanced archival features
- Automatic compliance validation
- Long-term preservation support
E-Invoice Premium (Planned)
- Factur-X / ZUGFeRD - Hybrid PDF/XML invoices (French/German/EU standard)
- XML Invoice Embedding - Attach structured XML data to PDF invoices
- Standards Compliance - EN 16931, PEPPOL, UBL 2.1, CII D16B formats
- Validation - Automatic invoice structure validation
- Digital Signatures - Sign embedded invoice data
- Metadata Extraction - Parse and extract invoice data from hybrid PDFs
- Multi-Country Support - Adapt to regional e-invoicing requirements
Premium modules are code-complete and fully tested (Encryption, Table, Zlib ready now). E-Invoice and PDF/A modules are in planning phase. We’re currently setting up the distribution and licensing system. Expected availability: soon.
Important: Premium modules are delivered as full, unencrypted source code - no black boxes, no compiled libraries. After payment, you receive the complete Xojo source code to inspect, modify, and integrate into your projects. Same transparency as the free version!
Flexible Pricing: Purchase Modules Separately - You don’t need to buy all premium modules! Each module (Encryption, Table, Zlib, PDF/A, E-Invoice) can be purchased individually based on your specific needs. Only pay for the features you’ll actually use!
Interested in early access? Contact us through this forum thread to discuss beta testing or early licensing.
Quick Start
// Create document
Dim pdf As New VNSPDFDocument(VNSPDFModule.ePageOrientation.Portrait, _
VNSPDFModule.ePageUnit.Millimeters, _
VNSPDFModule.ePageFormat.A4)
// Add page
pdf.AddPage()
// Set font (core font)
pdf.SetFont("Helvetica", "", 16)
// Output text
pdf.Cell(0, 10, "Hello from Xojo FPDF!")
// Or use Unicode with TrueType font
pdf.AddUTF8Font("Arial", "", "/System/Library/Fonts/Supplemental/Arial Unicode.ttf")
pdf.SetFont("Arial", "", 14)
pdf.Cell(0, 10, "你好世界! مرحبا بالعالم!")
// Save PDF
If pdf.Ok() Then
Dim f As FolderItem = SpecialFolder.Desktop.Child("output.pdf")
Call pdf.SaveToFile(f)
Else
MsgBox "Error: " + pdf.GetError()
End If
Architecture Highlights
Smart Code Sharing
- All PDF logic in shared
PDF_Library/ folder
- Platform-specific only for file I/O and UI
- Conditional compilation for platform differences
- Module-based organization (VNSPDFModule, VNSPDFExamplesModule)
Clean API Design
- Consistent naming - All classes prefixed with VNS
- Go-style error handling - Ok/Err pattern
- Delegate callbacks - Header/Footer functions
- Printf formatting - Cellf(), Writef() for convenience
- Method chaining - Fluent API where appropriate
Reference Implementations
Based on proven libraries with millions of downloads:
- go-pdf/fpdf (Go) - Primary reference
- PHP FPDF (PHP) - Original library (2000)
Known Limitations & Roadmap
We’re transparent about what doesn’t work yet and our plans to fix it:
Web Platform Limitations
WebChart Embedding - WebChart has protected constructor, cannot be converted to Picture
Planned: Server-side chart rendering using pure Xojo graphics
Color Emoji Support - Server-side Graphics API cannot access system emoji fonts
Planned: Direct font file parsing (SBIX, COLR/CPAL, CBDT/CBLC formats)
iOS Platform Notes
String Functions - All cross-platform differences handled with conditional compilation
File I/O - SpecialFolder.Documents instead of Desktop
Image Handling - JPEG encoding for Picture objects (iOS RGBA→RGB conversion)
Compression (Free) - System zlib uses Declares, blocked by iOS sandboxing
Solution: Premium Pure Xojo Zlib (no declares) works perfectly on iOS!
Desktop/Console
No known limitations - All features fully working
Bottom Line: Desktop and Console are 100% feature-complete. Web and iOS have minor limitations with workarounds available or in development.
November Contest Entry
This project demonstrates:
Innovation - First open-source Unicode PDF library for Xojo
Quality - 19 working examples, cross-platform, well-documented
Practicality - Solves real pain points (Unicode, closed source)
Completeness - Full feature set from fonts to encryption
Community Value - Open source, extensible, educational
Get it here : Xojo FPDF - Pure Xojo PDF Generation with Full Unicode Support - verynicesw