Last Updated:

Xojo FPDF - ZLib Module

Jean-Yves POCHEZ Xojo FPDF

πŸ—œοΈ Make Your PDFs 60% Smaller - Everywhere

The Problem

PDF files can be huge. A 50-page report with images easily reaches 10-20 MB. That’s:

  • ❌ Slow to download
  • ❌ Expensive to store
  • ❌ Painful to email
  • ❌ Bandwidth-heavy

Worse yet: iOS sandboxing blocks access to system compression libraries, so your iOS app generates bloated PDFs while your Desktop app makes tiny ones.

The Solution

The VNS PDF Zlib Module provides pure Xojo compression that works identically on all platforms - especially iOS.


✨ Key Benefits

Dramatic Size Reduction

  • 27-60% smaller PDFs (typical)
  • Works on text, fonts, images, and metadata
  • Industry-standard FlateDecode compression
  • Compatible with all PDF readers

iOS Support - Finally!

This is the killer feature.

Without Zlib Module (iOS):

pdf.Compressed = True  // ❌ Fails silently - no compression
// Result: 10 MB PDF

With Zlib Module (iOS):

pdf.Compressed = True  // βœ… Works perfectly
// Result: 4 MB PDF (60% smaller)

Cross-Platform Consistency

The same PDF generated on Desktop, Web, iOS, and Console will be:

  • βœ… Identical file size
  • βœ… Identical compression ratio
  • βœ… Identical quality

No platform-specific code needed.


πŸ“Š Real-World Examples

Text-Heavy Documents

Before: 2.5 MB (uncompressed invoice with 1,000 line items) After: 0.9 MB (64% reduction)

Image-Rich Reports

Before: 15 MB (50-page report with charts and photos) After: 6 MB (60% reduction)

Font-Embedded Documents

Before: 800 KB (multi-page contract with TrueType fonts) After: 320 KB (60% reduction)


πŸ”§ Technical Excellence

Pure Xojo Implementation

  • No external dependencies - No DLLs, dylibs, or .so files
  • No Declares - No platform-specific API calls
  • No Plugin - No third-party plugins required
  • 100% Xojo - Native code that works everywhere

zlib 1.3.1 Compliant

  • RFC 1950 (zlib format)
  • RFC 1951 (DEFLATE compression)
  • RFC 1952 (gzip format)
  • Adler-32 checksum validation

Optimized Performance

  • Fast compression (< 100ms for typical documents)
  • Low memory footprint
  • Streaming compression for large files
  • Efficient Huffman encoding

πŸ’Ό Perfect For

iOS Applications The only way to get compressed PDFs on iOS without jailbreaking or workarounds.

Web Applications Reduce bandwidth costs and improve download times for user-generated PDFs.

Cloud Storage Save 60% on S3, Dropbox, or Google Drive storage costs.

Email Attachments Stay under email size limits with smaller PDFs.

Mobile Apps Reduce app data usage and improve user experience on slow connections.

Offline Documents Pack more documents into limited device storage.


πŸš€ One-Line Activation

// That's it. Seriously.
pdf.Compressed = True

The Zlib Module integrates seamlessly with VNSPDFDocument. No API changes, no configuration, no complexity.

If the module is installed: Full compression works everywhere (including iOS). If the module is missing:Desktop/Linux use system zlib, iOS skips compression (free version behavior).


πŸ“± iOS: The Critical Use Case

Why iOS Needs This Module

iOS sandboxing prevents apps from accessing:

  • ❌ /usr/lib/libz.dylib (system compression)
  • ❌ External frameworks
  • ❌ Command-line utilities

Standard Xojo iOS apps cannot compress PDFs without this module.

The Alternative?

  • Ship uncompressed PDFs (10x larger)
  • Use cloud API for compression (requires internet, privacy risk)
  • Ship a C-based compression framework (complex, risky)

The Smart Choice?

  • Buy the Zlib Module ($49)
  • Enable compression with one line
  • Works offline, private, simple

πŸ” Under the Hood

Deflate Algorithm

  • LZ77 sliding window compression
  • Huffman coding for optimal bit packing
  • Dynamic Huffman trees for better compression
  • Block-level optimization

Adler-32 Checksums

Ensures data integrity - decompression validates the checksum to detect corruption.

PDF Integration

  • Automatic /Filter /FlateDecode insertion
  • Content stream compression
  • Font stream compression
  • Metadata compression

βœ… What You Get

  • βœ… Full source code - VNSZlibPremium*.xojo_code (5 modules)
  • βœ… Deflate compression - Industry-standard algorithm
  • βœ… Inflate decompression - For future features
  • βœ… Adler-32 checksums - Data integrity validation
  • βœ… All platforms - Desktop, Web, iOS, Console
  • βœ… Documentation - Implementation guide and examples
  • βœ… 12 months free updates - Compatible with future versions

πŸ†š Free vs Premium

FeatureFree VersionZlib Module
macOS compressionβœ… System zlib (60%)βœ… Pure Xojo (60%)
Windows compression⚠️ Requires ZLIB1.DLLβœ… No DLL needed
Linux compressionβœ… System zlib (60%)βœ… Pure Xojo (60%)
iOS compression❌ NONE (0%)βœ… Full (60%)
Web compression⚠️ Platform-dependentβœ… Works everywhere
External dependencies⚠️ DLLs/dylibsβœ… None
Cross-platform⚠️ Inconsistentβœ… Identical everywhere

Why upgrade? iOS is the killer feature. Without this module, your iOS PDFs are 2-3x larger than Desktop PDFs. For iOS apps or true cross-platform consistency, this module is essential.


πŸ’° Pricing

One-Time Purchase: €50

Special Offer: Buy 2, Get 1 Free! Mix and match any premium modules. Essential for iOS apps - combine with Encryption, Tables, PDF/A, Forms, or E-Invoice.

What’s Included:

  • Complete zlib 1.3.1 implementation in pure Xojo
  • Deflate compression and inflate decompression
  • Adler-32 checksum module
  • Huffman tree implementation
  • 12 months free updates
  • Installation guide and documentation

πŸ’³ Payment & Delivery

Payment: PayPal only (secure payment processing)

Delivery: Manual process - please allow 2-3 business days after payment for delivery via email.

You will receive:

  • VNSZlibPremium*.xojo_code (5 source files)
  • Complete documentation
  • Installation guide
  • License information

πŸ›’ Purchase

PayPal payment button below. After payment, you’ll receive an email confirmation, and your module will be delivered within 2-3 business days.

Purchase Zlib Module - €50


πŸ“Š Compression Comparison

PlatformFree VersionZlib Module
macOSSystem zlib (60% compression)Pure Xojo (60% compression)
WindowsRequires ZLIB1.DLLPure Xojo (no DLL needed)
LinuxSystem zlib (60% compression)Pure Xojo (60% compression)
iOS❌ NO COMPRESSIONβœ… 60% compression
WebPlatform-dependentPure Xojo (works everywhere)

❓ Frequently Asked Questions

Q: Does this work on Desktop too? A: Yes! It works on all platforms. Desktop can use either system zlib (free) or pure Xojo (premium).

Q: What’s the compression ratio? A: Typically 27-60% depending on content. Text compresses better than images.

Q: Does it slow down PDF generation? A: Minimal impact. Compression typically adds < 100ms to generation time.

Q: Can I disable compression for specific documents? A: Yes. Set pdf.Compressed = False to disable compression for that document.

Q: Does it work with encrypted PDFs? A: Yes! Compression happens before encryption for maximum size reduction.

Q: Is the decompression code included? A: Yes! Inflate (decompression) is included for future features like PDF import.


🎯 Why This Matters

For iOS Developers: This is a must-have. It’s the difference between shipping 10 MB PDFs and 4 MB PDFs.

For Web Developers: Reduce bandwidth costs and improve user experience.

For Enterprise: Compliance with file size limits and storage optimization.

For Everyone: Smaller PDFs = happier users.


Enable Compression Everywhere - €50

πŸ’‘ Bundle & Save: Buy 2 modules, get 1 free! View All Modules β†’

Free version: Desktop/Linux use system zlib. iOS has no compression.