The Xojo VNS FPDF Thread

Followup to the first Xojo FPDF port in the november contest here:

Xojo FPDF v1.1.1 - Major Update: Drop-in PDFDocument Replacement + Premium Modules

Hi everyone,

Big update on Xojo FPDF! Lots of new features, important bug fixes thanks to community testing, and the premium modules are now available on the website.
The github repo for free files is here :


VNSPDFDocument - True Drop-in Replacement for Xojo PDFDocument

The headline feature of this release: VNSPDFDocument is now fully compatible with Xojo’s native PDFDocument API. You can migrate with minimal code changes:

// Before (Xojo PDFDocument)
Dim pdf As New PDFDocument(PDFDocument.PageSizes.A4)
pdf.Title = "My Document"
Dim g As Graphics = pdf.Graphics
g.DrawingColor = Color.Blue
g.FillRectangle(100, 100, 200, 50)
g.LineCap = Graphics.LineCapTypes.Round
g.LineDash = Array(5.0, 5.0)
g.DrawText("Hello World", 100, 200)
pdf.Save(file)

// After (VNS PDF) - Nearly identical!
Dim pdf As New VNSPDFDocument()
pdf.Title = "My Document"
Dim g As VNSPDFGraphics = pdf.Graphics  // Only type name changes
g.DrawingColor = Color.Blue
g.FillRectangle(100, 100, 200, 50)
g.LineCap = Graphics.LineCapTypes.Round  // Same Xojo enums!
g.LineDash = Array(5.0, 5.0)            // Same syntax!
g.DrawText("Hello World", 100, 200)
pdf.Save(file)

Same properties: Title, Author, Subject, Keywords, Creator, Language, CurrentPage, PageHeight, PageWidth, Landscape, Compressed, Graphics

Same methods: Save(file), ToData(), AddFonts(), ClearCache(), Template()

VNSPDFGraphics is 100% complete - all 43 features from Xojo’s PDFGraphics API work:

  • Drawing: DrawLine, DrawRectangle, FillRectangle, DrawOval, FillOval, DrawPolygon, FillPolygon, DrawPath, FillPath, DrawPicture
  • Text: DrawText (with rotation), DrawTextBlock (word-wrap with CJK support), TextWidth, TextHeight
  • Object2D: RectShape, OvalShape, RoundRectShape, ArcShape, CurveShape, FigureShape, TextShape (with HorizontalAlignment), PixmapShape, Group2D (with rotation)
  • Transforms: Rotate, Translate, Scale, Transform (matrix)
  • State: SaveState, RestoreState
  • Clipping: ClipToRectangle, ClipEnd
  • Properties: Bold, Italic, Underline, FontName, FontSize, DrawingColor, PenSize, LineCap, LineJoin, LineDash, Brush

But you also get everything Xojo PDFDocument can’t do - on the same object:

// Advanced FPDF methods available on VNSPDFDocument
pdf.AddUTF8Font("Arial", "", fontPath)           // Full Unicode
pdf.MultiCell(180, 5, longText, "1", "J", False)  // Justified text
pdf.ImportPage(sourcePDF, 1)                       // PDF import
pdf.SetProtection("user", "owner", perms, 3)      // Encryption
pdf.AddAttachment("data.xml", xmlContent, "desc")  // File attachments

File Attachments - E-Invoice Ready

You can now embed files directly in your PDFs, both at the document level (visible in the PDF sidebar) and as clickable page annotations:

// Document-level attachment
pdf.AddAttachment("factur-x.xml", xmlInvoice, "Factur-X invoice data")

// Clickable icon on a specific page
pdf.AddAttachmentAnnotation("data.xml", xmlContent, 150, 20, 10, 10, "Click to open")

This is the foundation for Factur-X/ZUGFeRD hybrid PDF/XML e-invoicing.


Multi-Stop Gradients

Complex gradients with unlimited color stops, plus full Xojo Brush support:

// Rainbow gradient
Dim stops() As Pair
stops.Add(0.0 : Color.Red)
stops.Add(0.25 : Color.Yellow)
stops.Add(0.5 : Color.Green)
stops.Add(0.75 : Color.Cyan)
stops.Add(1.0 : Color.Blue)
pdf.LinearGradientMultiStop(10, 10, 180, 40, stops, 0, 0, 1, 0)

// Or use Xojo-compatible Brush property
Dim lgb As New LinearGradientBrush
lgb.GradientStops.Add(0.0 : Color.Red)
lgb.GradientStops.Add(1.0 : Color.Blue)
g.Brush = lgb
g.FillRectangle(10, 60, 100, 40)

LinearGradientBrush, RadialGradientBrush, and PictureBrush are all supported.


Complete Transformation Suite

All 18 transformation methods are now implemented: TransformRotate, TransformScale, TransformTranslate, TransformMirrorHorizontal, TransformMirrorVertical, TransformMirrorPoint, TransformMirrorLine, TransformSkew, and more. Example 21 demonstrates every single one.


Bounds Checking

New optional safety feature - catch drawing operations outside page boundaries:

VNSPDFModule.gkRaiseExceptionOnOutOfBounds = True
pdf.Rect(-10, -10, 100, 100)  // Raises RuntimeException!

Affected methods: Rect, Line, Ellipse, Image, Text, Cell, MultiCell, annotations. In normal mode it logs warnings via System.DebugLog without interrupting execution.


Bug Fixes Thanks to Community Feedback

A big thank you to the Xojo users who tested the library on their machines and reported real-world issues. Their feedback led to five important fixes:

MultiCell single-line bottom border - A single-line MultiCell with border=1 was missing its bottom border on all platforms. Fixed.

First character missing in long word wrapping - When a long word wrapped to the next line, the first character was dropped. Classic off-by-one error, now fixed.

Newlines ignored in MultiCell - Explicit newlines (Chr(10)) and CRLF sequences were completely ignored, all text appeared on one line. SplitTextToLines now handles paragraph breaks properly.

MultiCell positioning - The cell following a MultiCell was offset to the right instead of returning to the left margin. Cursor position now resets correctly.

ImageFromPicture corruption on Windows and Linux - The most visible bug. ImageFromPicture produced corrupted images (multi-colored noise) on Windows 11 and Linux. Root cause: Picture.ToData(PNG) on these platforms produces RGBA (4 channels) while PDF expects RGB (3 channels). Fix: force JPEG format on Windows/Linux - JPEG auto-converts RGBA to RGB cleanly. Verified on macOS, Windows 11, and Ubuntu 22.04 ARM64.

Example 26 provides a visual test suite for all five fixes.


Premium Modules Now Available

The first three premium modules are ready and available on the website: Premium Modules - Professional PDF Features

Encryption Module - EUR 50

AES-256/128 encryption with dual password protection and granular permissions (print, copy, modify, annotate, etc.). The free core only includes RC4-40 (40-bit). If you handle sensitive documents, you need at least AES-128.

Table Module - EUR 50

Three table engines (SimpleTable, ImprovedTable, FancyTable) with automatic column sizing, auto pagination with header repetition, alternating row colors, and smart number alignment. What takes 50+ lines of Cell() calls takes one line with this module.

Zlib Module - EUR 50

Pure Xojo deflate/inflate compression (27-60% file size reduction). Particularly important for iOS developers: without this module, iOS PDFs have zero compression while Desktop PDFs get 27-60% reduction. This module eliminates that gap completely.

Bundle: Buy 2, Get 1 Free = EUR 100

Every module includes:

  • Full source code (unencrypted, readable, modifiable)
  • Lifetime license, no subscriptions
  • All platforms (Desktop, Web, iOS, Console)
  • 12 months free updates
  • Payment via PayPal, delivery within 2-3 business days

Current Status

Xojo FPDF v1.1.1 - Production release

  • 23 working examples covering all features
  • Cross-platform: Desktop, Web, iOS, Console (Xojo 2025r3.1 API2)
  • Drop-in replacement for Xojo’s PDFDocument
  • Full UTF-8 with Arabic text shaping and CJK wrapping
  • PDF Import, File Attachments, Encryption, Multi-Stop Gradients
  • 100% open source core (MIT license)

Coming next:

  • PDF/A Module - ISO-compliant archival PDFs
  • Forms Module - Interactive AcroForms
  • E-Invoice Module - Factur-X/ZUGFeRD compliance

Questions? Just ask in this thread. And keep the bug reports coming - community feedback directly improves the library for everyone.

12 Likes

Really nice! Any chance of getting html → pdf soon? And preferably not with some outdated code.

2 Likes

Yes.
but it will be a “simple” one : styled text, lists, tables, pictures only at first release
mainly for outputting some html text to a pdf (not a full web page with javascript or so)
and it will be a premium module.
as you get the full source code you will be able to add your own processing in it.

edit: I will also provide a free compiled app to select your html file and see how it gets converted to pdf.

2 Likes

That’s a good start but my html is as complex as it gets.

1 Like

you will be able to add your own html tags

 //Custom HTML Tags

 pdf.RegisterHTMLTagHandler("company-header", AddressOf CompanyHeaderHandler)
 pdf.LoadHTML("<company-header>ACME Corp</company-header><p>Hello world</p>")

 Sub CompanyHeaderHandler(doc As VNSPDFDocument, token As VNSPDFHTMLToken, isClosing As Boolean)
   If Not isClosing Then
     doc.SetFont("Helvetica", "B", 20)
     doc.SetTextColor(0, 0, 128)
   Else
     doc.Ln(8)
     doc.SetFont("Helvetica", "", 10)
     doc.SetTextColor(0, 0, 0)
   End If
 End Sub

The problem aren’t the tags but the html itself. Have a look at some random newsletters. These usually have complex CSS and nested tables.

the purpose of this converter is to convert html YOU build
not print any html you may receive, it’s indeed too much complicated
the existing html to pdf converters are millions of lines of code
I certainly don"t intend to replace these…

1 Like

Xojo FPDF v1.2 - Digital Signatures, E-Invoicing, Barcodes, HTML/Markdown Import, PDF Preview & More

Follow-up to the v1.1.1 January 2026 announcement

Hi everyone,

Major release! Version 1.2 brings digital signatures validated by Adobe Acrobat, a complete EU e-invoicing module, 10 barcode types with vector rendering, HTML and Markdown to PDF conversion, an in-app PDF preview window, and much more. Here’s everything that changed since v1.1.


Digital Signatures - Adobe Acrobat Validated (Encryption Premium Module)

The big one. You can now digitally sign PDFs with PAdES-B-B signatures that Adobe Acrobat Reader validates as authentic:

Dim pdf As New VNSPDFDocument
pdf.SetFont("Helvetica", "", 12)
pdf.Cell(0, 10, "This document is digitally signed.")

// Sign with your certificate
VNSPDFSignature.SignPDF(pdf, certDER, privateKeyDER, _
    "Jean-Yves", "Contract approval", "Paris, France")
pdf.Save(outputFile)

What’s under the hood:

  • PAdES-B-B (PDF Advanced Electronic Signatures) per ETSI EN 319 142-1
  • XAdES-BES (XML Advanced Electronic Signatures) for signing CII XML in e-invoices
  • Pure Xojo RSA PKCS#1 v1.5 signing - no OpenSSL, no declares, no external dependencies
  • CRT optimization for fast 2048-bit RSA (~12x speedup over naive modular exponentiation)
  • CMS/PKCS#7 SignedData with ESS signing-certificate-v2 per RFC 5652
  • ASN.1 DER encoder/decoder, X.509 certificate parser, W3C C14N XML canonicalization
  • 7 new classes: VNSASN1, VNSX509Certificate, VNSPKCS7Signer, VNSPDFSignature, VNSXMLCanonicalizer, VNSXAdESSigner, VNSRSASigner

All pure Xojo. Works on Desktop, Web, iOS, and Console.


E-Invoice Premium Module - EU-Compliant Factur-X/ZUGFeRD

The EU ViDA directive mandates structured electronic invoicing for B2B transactions starting 2026-2027. This module handles both creating and reading compliant invoices:

Creating E-Invoices

Dim invoice As New VNSPDFEInvoice
invoice.InvoiceNumber = "INV-2026-001"
invoice.InvoiceDate = New DateTime(2026, 2, 14)
invoice.Currency = "EUR"
// ... set seller, buyer, line items, tax breakdowns ...

Dim pdf As New VNSPDFDocument
// ... add visual invoice layout ...

VNSPDFEInvoicePremium.CreateFacturXInvoice(pdf, invoice, _
    VNSPDFEInvoicePremium.eFacturXProfile.EN16931)
pdf.Save("invoice.pdf")

Generates a PDF/A-3b document with embedded CII XML per EN 16931. Self-contained: sRGB ICC output intent, XMP metadata with Factur-X extension schemas. No dependency on the PDF/A premium module.

Reading & Verifying E-Invoices

Open any PDF and check if it’s a valid Factur-X/ZUGFeRD invoice:

Dim result As JSONItem = VNSPDFEInvoicePremium.ReadEInvoice("/path/to/invoice.pdf")

If result.Value("valid") = True Then
  Dim inv As JSONItem = result.Value("invoice")
  // Access invoiceNumber, seller, buyer, lineItems, totals...
End If

// Also detects digital signatures
Dim sigCount As Integer = result.Value("signatureCount")
If sigCount > 0 Then
  Dim sigs As JSONItem = result.Value("signatures")
  // signer name, hash validity, certificate info, self-signed detection...
End If

Features:

  • 5 conformance profiles: MINIMUM, BASIC WL, BASIC, EN 16931, EXTENDED
  • Profile-aware validation with EU Business Term references (BT-1, BT-2, etc.)
  • XML validation warnings: comma-as-decimal detection, date format checks, currency/country code validation
  • Error codes (EINV-000 to EINV-004) for programmatic handling
  • Digital signature detection: SHA-256 hash verification, ByteRange coverage check, X.509 certificate subject/issuer, self-signed detection
  • Type-safe enums: eTaxCategoryCode (UNTDID 5305), eFacturXProfile, eInvoiceJSONKey with extension methods

Free Standalone App

We provide a free compiled VNS E-Invoicer app (macOS, Windows, Linux) so you can test e-invoice creation, reading, and validation on your own PDFs before purchasing the module. Don’t hesitate to try it with your own e-invoice PDFs and report here if you find files that don’t behave correctly!


HTML & Markdown to PDF (Premium Module)

Convert HTML or Markdown files to formatted PDFs:

Dim pdf As New VNSPDFDocument
pdf.LoadHTML(htmlContent)
pdf.Save("output.pdf")

// Or Markdown
pdf.LoadMarkdown(markdownContent)
pdf.Save("output.pdf")

HTML Support

Full tag support: p, h1-h6, b/strong, i/em, u, s/del/strike, br, hr, img, table, ul/ol/li, blockquote, code/pre, span, font, a, sub/sup. Inline CSS for font-size, color, background-color, text-decoration, font-family. Handles Word/Summernote HTML with automatic cleanup (68% size reduction on messy HTML).

Markdown Support

Headings, bold, italic, strikethrough, code blocks, lists, links, images, blockquotes, horizontal rules, tables.

Extensible

Register custom tag handlers for HTML or custom syntax handlers for Markdown:

pdf.RegisterHTMLTagHandler("custom-tag", AddressOf MyCustomHandler)
pdf.RegisterMarkdownHandler("^!!!(.+)", AddressOf MyAlertHandler)

Free Standalone Apps

We provide free compiled binaries of HtmlToPdf and MarkdownToPdf (macOS, Windows, Linux) so you can test conversion on your own files before purchasing the module. Don’t hesitate to try them with your own HTML and Markdown files and report here if you find content that doesn’t render correctly!


PDF Preview Window (Desktop)

Thanks to a contribution from Valdemar de Sousa, the library now includes an in-app PDF preview window:

  • Modal window with rendered PDF pages
  • Thumbnail sidebar navigation
  • Zoom and pan controls
  • Save and print buttons
  • Cross-platform page rendering: macOS PDFKit, Windows PowerShell+Windows.Data.Pdf, Linux Poppler

All 33 examples now support both “Save to Desktop” and “Preview” modes.


GraphicsPath - Full Xojo Compatibility

VNSPDFGraphicsPath is now fully compatible with Xojo’s GraphicsPath API:

Dim path As New VNSPDFGraphicsPath
path.MoveToPoint(50, 50)
path.AddCurveToPoint(100, 20, 150, 80, 200, 50)  // Cubic Bezier
path.AddArc(150, 150, 50, 0, 3.14159, False)      // Circular arc
path.AddRoundRectangle(10, 200, 180, 60, 15, 15)  // Round rectangle
path.CloseSubpath

g.DrawPath(path)     // Stroke
g.FillPath(path)     // Fill
g.ClipToPath(path)   // Clip

Segment types: MoveTo, LineTo, CubicBezierTo, QuadraticBezierTo, CloseSubpath, Rectangle. Plus Bounds() for bounding box and Contains(x, y) for hit testing. Example 29 demonstrates all features across 6 pages.


Barcode Module (E-Invoice Premium Module)

Generate scanner-ready barcodes directly in your PDFs. The premium module uses vector rendering (native PDF rectangles) for perfect print quality at any resolution - no raster images, no JPEG artifacts:

// Premium: vector barcodes on all platforms including Console
VNSPDFBarcode.DrawBarcode(pdf, VNSPDFModule.eBarcodeType.QRCode, 10, 50, 35, 35, "https://example.com")
VNSPDFBarcode.DrawBarcode(pdf, VNSPDFModule.eBarcodeType.EAN13, 10, 100, 60, 25, "4006381333931")
VNSPDFBarcode.DrawBarcode(pdf, VNSPDFModule.eBarcodeType.Code128, 10, 140, 80, 25, "PRODUCT-001")

10 barcode types supported:

  • 1D: Code 128, EAN-13, EAN-8, UPC-A, Code 39, ITF, Codabar
  • 2D: QR Code (ISO 18004), DataMatrix (ECC 200), PDF417

Free library also includes DrawQRCode() and DrawCode128() using Xojo’s built-in Barcode class (Desktop/Web/iOS only, raster rendering).

The premium renderers are pure Xojo math - Reed-Solomon error correction, GF(256) arithmetic, ISO-compliant encoding tables. No external libraries. Works everywhere including Console.

Example 33 is a 4-page showcase: free barcodes, premium 1D barcodes with Xojo Core comparison, premium 2D barcodes, and barcodes embedded in table cells.


Manual Table Builder (Table Premium Module)

Build tables without a database. Define columns, add rows as string arrays, and get the same professional output as the RowSet-based tables:

Dim table As New VNSPDFManualTable(6.0)
table.AddColumn("Region", 35.0, VNSPDFModule.eColumnAlignment.Left)
table.AddColumn("Product", 50.0, VNSPDFModule.eColumnAlignment.Left)
table.AddColumn("Qty", 25.0, VNSPDFModule.eColumnAlignment.Right)
table.AddColumn("Total", 35.0, VNSPDFModule.eColumnAlignment.Right)

table.AddRow(Array("East", "Software License", "3", "1,499.97"))
table.AddRow(Array("East", "Training Session", "3", "750.00"))
table.AddSubtotalRow(Array("", "Subtotal East", "6", "2,249.97"))

// Footer auto-sums skip subtotal rows — no double-counting
Dim footer() As VNSPDFManualTableFooterCell
footer.Add(New VNSPDFManualTableFooterCell("GRAND TOTAL", 2))
footer.Add(New VNSPDFManualTableFooterCell(VNSPDFModule.eFooterCalcType.Sum, 2, 1, ""))
footer.Add(New VNSPDFManualTableFooterCell(VNSPDFModule.eFooterCalcType.Sum, 3, 1, ""))
table.SetFooterCells(footer)
table.Render(pdf)

Features:

  • Multi-row merged headers with colspan
  • Inline subtotal rows with distinct styling (gray background, bold text)
  • Auto-calculated footers (SUM, AVG, MIN, MAX, COUNT) that skip subtotals
  • Per-cell style overrides — mix fonts, styles, sizes, and colors on individual cells
  • Per-column font/color overrides, pictures and barcodes in cells
  • Locale-aware number formatting for footer calculations
  • Automatic page breaks with header repetition

7 examples (10-16) demonstrate everything from basic tables to per-cell styling.


More Improvements

Full Text Justification - Cell, MultiCell, and WriteAligned now support justify alignment (“J”) using the PDF Twword spacing operator. New eTextAlignment enum for type-safe alignment.

Font Improvements - Font subsetter fix for short loca format fonts (Verdana, Trebuchet MS). AddUTF8Font() now auto-searches system fonts when called without a path. Font streams compressed with FlateDecode (~50% size reduction).

PDF Parser Fixes - Fixed hex/literal string parsing in VNSPDFDictionary/VNSPDFParser. Fixed VNSZlibModule CString truncation at null bytes. Fixed Int32 return type for zlib error codes.


Premium Modules - 5 Available

All modules available at verynicesw.fr/xojo-fpdf-premium-modules

Module Price Description
Encryption EUR 50 AES-256/128, RC4-128, digital signatures (PAdES-B-B, XAdES-BES)
Table EUR 50 SimpleTable, ImprovedTable, FancyTable, Manual Table Builder with subtotals and per-cell styling
Zlib EUR 50 Pure Xojo compression for iOS (27-60% reduction)
HTML/Markdown Import EUR 50 LoadHTML() and LoadMarkdown() with full formatting
E-Invoice EUR 50 Factur-X/ZUGFeRD create + read + validate + signature detection + barcode generation

Bundle: Buy 2, Get 1 Free = EUR 100

Every module includes full source code (unencrypted, readable, modifiable), lifetime license, all platforms, and 12 months free updates. Payment via PayPal.


By the Numbers

  • 33 working examples across 4 platforms
  • 5 premium modules available now, 2 more coming (PDF/A, Forms)
  • 10 barcode types with vector rendering for perfect print quality
  • 7 new cryptography classes for digital signatures
  • 8 new e-invoice classes for EU compliance
  • 9 new barcode classes for scanner-ready barcodes
  • Cross-platform: Desktop, Web, iOS, Console (Xojo 2025r3.1 API2)
  • Tested on macOS, Windows 11, Linux ARM64

Questions, feedback, or bug reports? Post in this thread. Community testing has been invaluable - every bug report makes the library better for everyone.

2 Likes

I tried the app HtmlToPDF.

  1. The app is in French locale.
  2. The app doesn’t do anything.

OUPS ! seems my beta testers team did not fullfil their job ! :wink:
I fixed htmltopdf and markdowntopdf
vns e-invoicer is fixed too.

1 Like

The pdf for my new app is way more simple than for the email app. I mostly need text, images, urls and url previews like this:

Would that work in your library?

Yes you can draw anything you want on a page, pictures or text are available in the free library
take a look at example 9 for that

I just uploaded the 1.2.1 version to fix a mini mess between free and premium classes.

Xojo FPDF v1.3 - Major Update: CSS Engine, Digital Signatures, Barcodes & More

Follow-up to the v1.2 February 2026 announcement

Hi everyone,

Version 1.3 is a big one. The HTML/Markdown module now has a near-complete CSS rendering engine (variables, box model, selectors, cross-page layout), the E-Invoice module ships with a full barcode library, and there are significant fixes across compression, PDF import, and cross-platform rendering.

Here’s what’s new.


What’s in v1.3

HTML/Markdown Import: Full CSS Engine (Premium Module)

The LoadHTML() rendering engine has been substantially upgraded. Real-world HTML — WhatsApp exports, styled newsletters, CMS output — now renders with proper spacing, colors, and layout.

CSS Custom Properties (Variables)

<style>
:root {
  --primary-color: #333;
  --card-bg: #f5f5f5;
  --font-size: 120%;
}
</style>
<div style="color: var(--primary-color); background: var(--card-bg)">
  Styled with CSS variables
</div>
  • :root { --name: value; } with var(--name) and var(--name, fallback) resolution
  • Nested var() references, multiple :root blocks (theme overrides)
  • @media (prefers-color-scheme: dark) blocks automatically skipped (light mode rendering)
  • Works in inline styles, <style> blocks, and shorthand properties

CSS Selectors

  • Class (.card), element (p), element.class (div.card), ID (#header)
  • Comma-separated (.card, .url-card { ... })
  • Merges <style> rules with inline style="" attributes (inline wins)
  • !important suffix stripped automatically

Block-Level CSS Properties

  • width, max-width (px, %) — constrains block content area
  • margin — shorthand (1-4 values) and individual sides; margin: 0 auto centering
  • padding — shorthand and individual sides; font-metrics-based vertical centering
  • border — all 4 sides independently (1px solid #333), width keywords (thin/medium/thick)
  • background-color — block-level fill behind content and borders
  • border-radius — rounded corners on blocks and cards
  • line-height, display: none, text-transform (uppercase, lowercase, capitalize)

CSS Box Model Rendering

  • Background fills inserted before borders in PDF stream (correct layering)
  • Font-metrics-based vertical text centering inside padded/bordered blocks (uses GetFontDesc() ascent/descent)
  • CSS margin collapsing: child trailing gap collapsed with parent padding-bottom — max(trailingGap, paddingBottom)
  • Cross-page border-radius: cards spanning page breaks render fully rounded corners on each page (parent background + child clipping)
  • Nested box rendering with full push/pop state management

Merge Fields (Mail Merge)

Var fields() As String = VNSPDFHTMLPremium.CollectMergeFields(templateHTML)
Var merged As String = VNSPDFHTMLPremium.ApplyMergeValues(templateHTML, dict)
pdf.LoadHTML(merged)
  • Scan HTML for {{field}} and <span class="merge-field"> placeholders
  • Replace with text or Picture values (auto-converted to <img> tags)
  • Preserves inline styles (font-weight, color) from merge field spans
  • CollectAnchors() extracts <a> link targets

External Images

pdf.LoadHTML(htmlContent, 0, imageFolder)
// <img src="logo.png">                       — local file
// <img src="https://example.com/banner.png"> — downloaded
// <img src="data:image/png;base64,...">       — still works

Images cached per render call. Bad URLs skipped silently.

Performance

  • HTML tokenizer rewritten as single-pass MemoryBlock byte scanner (~5x faster on large files)

Rendering Fixes

  • Fixed bold/italic leaking across <span> boundaries
  • Fixed text overlap in paragraphs and justified/aligned text
  • Fixed inline highlight rect misaligned with centered/right text
  • Fixed right-aligned text truncated in width-constrained blocks
  • Code blocks: per-line gray background with multi-page support
  • Blockquote bars: per-page vertical bar rendering with correct alignment
  • Link annotation rects aligned with text for multi-line <a> tags

If you purchased the HTML/Markdown module, this is a major upgrade.


Barcode Module (E-Invoice Premium Module)

A full barcode rendering library is now included with the E-Invoice module:

Free library (built on Xojo’s Barcode class):

  • DrawQRCode() and DrawCode128() — Desktop/Web/iOS

Premium (pure Xojo, ALL platforms including Console):

  • 1D barcodes: Code128, EAN-13, EAN-8, UPC-A, Code 39, ITF, Codabar
  • 2D barcodes: QR Code (ISO 18004), DataMatrix (ECC 200), PDF417

All barcodes are vector-rendered as native PDF rectangles — perfect print quality at any resolution, no JPEG artifacts.

VNSPDFBarcode.DrawBarcode(doc, VNSPDFBarcode.eBarcodeType.QRCode, x, y, w, h, "https://example.com", True)
VNSPDFBarcode.DrawBarcode(doc, VNSPDFBarcode.eBarcodeType.EAN13, x, y, w, h, "4006381333931", True)

Example 33: 4-page showcase — free barcodes, premium 1D with Xojo Core comparison, premium 2D, barcodes in table cells.


Digital Signatures (Encryption Premium Module)

Added in v1.2 and refined in v1.3:

  • PAdES-B-B (PDF Advanced Electronic Signatures) per ETSI EN 319 142-1
  • XAdES-BES (XML Advanced Electronic Signatures) for CII XML signing
  • Pure Xojo RSA PKCS#1 v1.5 with CRT optimization (~12x speedup for 2048-bit keys)
  • Validated by Adobe Acrobat Reader (document integrity verified)
  • Example 32: Complete digital signature demonstration

Forms Module: Phase 1 (Premium Module)

  • All 9 Xojo control types: TextField, TextArea, CheckBox, RadioButton, Button, ComboBox, ListBox, PopupMenu, Signature
  • Button actions: ResetForm, SendForm, SendPDFFile, URI
  • Phase 1 at 82% complete per ISO 32000-2 AcroForms spec
  • Example 24: Side-by-side Xojo native vs VNS comparison

Zlib Compression: Native-First Strategy

Compression architecture redesigned:

  • Desktop/Web/Console: Native C zlib via system declares (instant). Previously the premium module accidentally overrode the native path.
  • iOS: Premium pure Xojo zlib continues to work (system declares blocked by sandboxing). Auto-switches to compression level 1 for inputs >100KB.
  • Hash chain optimization: Pure Xojo deflate rewritten — reduced from ~32K comparisons per byte to max 128. Example 19 (Tables, ~49KB) no longer hangs.

PDF Import: Better Compatibility

  • Array content streams (common in professional PDFs) no longer crash
  • Double indirect references handled
  • Empty content pages produce empty templates instead of fatal errors
  • FlateDecode: auto-detects all valid zlib headers (was only checking 0x78)

PDF Preview Window (Desktop)

  • In-app modal preview with rendered PDF pages, thumbnail navigation, zoom/pan, save, and print
  • Cross-platform: macOS (PDFKit), Windows (WinRT), Linux (Poppler)
  • All 33 examples support both save-to-desktop and in-app preview

Per-Project Premium Constants

Premium module activation moved from shared VNSPDFModule.xojo_code to per-project _Premium_Constants.xojo_code files. Toggling a constant for one project no longer affects others sharing the same PDF_Library/ folder.


Bug Fixes (v1.3)

  • AES Encryption blank pages: MiddleBytes() off-by-one (API2 is 0-based, callers were passing 1-based)
  • Color overloads always black: API1-era \ 256 division on Color components removed (API2 returns 0-255 directly). Thanks to Geoff Bridges.
  • SetDisplayMode not written to PDF: Now outputs /OpenAction and /PageLayout to catalog. Contribution: Geoff Bridges.
  • Huffman table corruption: mStaticLTreeLen had 290 entries instead of 288 per RFC 1951
  • Windows preview blank pages: PowerShell 5.1 WinRT stream position and extension method fixes
  • macOS ARM64 zlib crash: UInt32UInt64 for LP64 ABI compatibility in system declares
  • Standalone apps: SaveFileDialog for sandbox compatibility, English-only UI

Current Project Status

33 working examples across 4 platforms (Desktop, Web, iOS, Console)

Core Features (all working):

  • Document/page management, metadata, units, error handling
  • Core fonts (Helvetica, Times, Courier) + TrueType/UTF-8 with auto system font loading
  • Text: Cell, MultiCell, Write, Text, Cellf/Writef (printf-style), justified/centered/right alignment
  • Graphics: Line, Rect, Circle, Ellipse, Arc, Bezier, Arrow, Polygon, GraphicsPath
  • Transformations: TransformBegin/End, TransformRotate, Transform (full matrix)
  • Images: JPEG/PNG, ImageFromPicture
  • Stream compression (FlateDecode/zlib) — 27-60% size reduction
  • Header/Footer callbacks, links, bookmarks
  • Arabic text shaping, PDF Import (XObject templates)
  • VNSPDFGraphics: full Xojo PDFGraphics-compatible wrapper (41 features)
  • In-app PDF Preview Window (Desktop)

Premium Modules (5 available, €50 each):

Module What It Does
Encryption AES-256/128, RC4, permissions, PAdES-B-B digital signatures
Table SimpleTable/ImprovedTable/FancyTable, auto-pagination, per-cell styling, subtotals
Zlib Pure Xojo compression for iOS (27-60% reduction)
HTML/Markdown Import LoadHTML(), LoadMarkdown(), CSS engine, merge fields, custom handlers
E-Invoice Factur-X/ZUGFeRD EN 16931, CII XML, ReadEInvoice checker, Barcode module (QR, Code128, EAN-13, EAN-8, UPC-A, Code 39, ITF, Codabar, DataMatrix, PDF417)

Bundle: Buy 2, Get 1 Free = €100 (save €50)

Coming Soon:

  • PDF/A Module: ISO-compliant archival PDFs
  • Forms Module Phase 2: Full AcroForms interactive fields

Upgrading

Free library users: Update VNSPDFDocument.xojo_code, VNSZlibModule.xojo_code, and the Import folder files for better compatibility.

HTML/Markdown Premium: Update VNSPDFHTMLRenderer.xojo_code and VNSPDFHTMLTableRenderer.xojo_code — this is a major upgrade with CSS variables, box model, and many rendering fixes.

Zlib Premium: Update VNSZlibPremiumDeflate.xojo_code and VNSZlibPremiumTrees.xojo_code for hash chain optimization and Huffman table fix.

E-Invoice Premium: Update for barcode module files and ReadEInvoice improvements.

Contact us if you need updated files for your purchased modules.


Free Standalone Apps

HtmlToPdf and MarkdownToPdf converter apps are available for free download (macOS, Windows, Linux). Test HTML/Markdown-to-PDF conversion on your own files before purchasing the premium module.

VNS E-Invoicer is a free standalone desktop app for creating, opening, editing, and exporting Factur-X/ZUGFeRD e-invoices:

  • Create invoices: Multi-window document architecture — fill in seller/buyer, line items, tax breakdowns, payment info
  • Open existing e-invoices: Drag any Factur-X or ZUGFeRD PDF to verify conformity, view invoice data, and check digital signatures
  • EN 16931 validation: Invoices are validated against the European standard before export
  • Digital signatures: Sign exported PDFs with PAdES-B-B — includes a built-in self-signed certificate generator (RSA 2048-bit)
  • Signature verification: Green “Integrity verified” / red “WARNING: Document may have been tampered with!” status display
  • Check Folder: Batch-check a folder of PDFs for Factur-X/ZUGFeRD conformity with validation details and signature status
  • Preferences: Company defaults, payment info, tax rates, and digital signature configuration saved between sessions

The app is built entirely with the Xojo FPDF library and premium modules — it’s a real-world showcase of what the library can do. Available for macOS.


Questions, feedback, or bug reports? Post in this thread!

Xojo FPDF v1.3 - Pure Xojo, Full Unicode, Cross-Platform
Desktop | Web | iOS | Console
Tested on macOS, Windows 11, Linux ARM64

4 Likes

Impressive! I haven’t had time to study the product yet. For the e-invoicing module: Like many others, I think, I already generate traditional PDF invoices. Is there a solution for this in FPDF?

- 1) Import a PDF invoice that has already been generated (with DynaPdf in my case),

- 2) Import the data (real data, not derived from the PDF) to generate the XML.

- 3) Check and generate the final hybrid file (Factur-X EN16931 in my case)

Also, when I produce a test invoice with VNSEinvoicer and run this invoice through a platform validator (for a French Factur-X EN16931 invoice), https://www.superpdp.tech/outils/validateur-facture-electronique , I get warning messages about missing information: “frais de recouvrement” (PMT), late payment penalties (PMD), “escompte“ (AAB), BT49, and BT 34 are missing. For example:

<svrl:failed-assert test="exists($notes[ram:SubjectCode = &apos;PMD&apos;])" id="BR-FR-05_BT-22_PMD" flag="warning" location="/*:CrossIndustryInvoice[namespace-uri()=&apos;urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100&apos;][1]/*:ExchangedDocument[namespace-uri()=&apos;urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100&apos;][1]">
    <svrl:text>
        BR-FR-05/BT-22 : La mention relative aux pénalités de retard (code PMD) est absente. Elle est obligatoire dans les notes (BG-1).
      </svrl:text>
</svrl:failed-assert>

will look into this. thanks for the feedback. it should be an easy fix (hope so…).

it is already there : VNSEInvoicer can open read factur-x or not factur-x pdfs, then modify and save it again as a factur-x. for now it saves as it own pdf tempalte, but you can import pdf with the free fpdf library and build your own from this source pdf. you can also sign them if needed.

please be aware that the French superpdp.tech validator always applies FR-specific rules (BR-FR-05, BR-FR-10) regardless of the seller’s country

just updated the VNS E-Invoice demo apps
Xojo-VNS-fpdf-Library/VNSE-Invoicer at main · JYPochez/Xojo-VNS-fpdf-Library · GitHub

now the validation depends on the choosen country (in the settings) for the seller
and if you open an existing pdf you can add e-invoice datas and save it it will be a valid e-invoice.
enjoy !