No description
Find a file
Stefan von Buddenbrock 7a2ce897ce Initial commit: XFA PDF to standard PDF converter
Converts Adobe LiveCycle XFA PDFs (which require Acrobat to open) to
standard image-based PDFs readable in Preview. Uses a V8-enabled build
of pypdfium2 to render XFA content, assembled into a PDF via img2pdf.

Ships as a macOS Finder Quick Action; run setup.sh to install.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 17:27:59 +02:00
Convert PDF for Preview.workflow/Contents Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
.gitignore Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
.python-version Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
convert_pdf.py Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
convert_pdf.sh Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
pyproject.toml Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
README.md Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
setup.sh Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00
uv.lock Initial commit: XFA PDF to standard PDF converter 2026-05-16 17:27:59 +02:00

PDF Tool

Converts Adobe Acrobat / XFA PDFs to standard PDFs that open in macOS Preview. Installs as a Finder Quick Action (right-click menu).

Why this exists

Some PDFs created with Adobe LiveCycle Designer use XFA (eXtensible Forms Architecture), which stores all visual content in Adobe-proprietary XML streams. Standard viewers (Preview, browsers) show only a fallback message. This tool renders the XFA content using a V8-enabled build of PDFium and re-exports it as a standard image-based PDF.

Limitation: text wrapping and font rendering may differ slightly from Adobe Acrobat due to font substitution in the open-source XFA renderer.

Prerequisites

  • macOS (Apple Silicon or Intel)
  • Homebrew
  • uv: brew install uv

Setup

git clone <repo> pdf_tool
cd pdf_tool
bash setup.sh

setup.sh will:

  1. Build and install Python dependencies (including a V8-enabled pypdfium2)
  2. Install the Convert PDF for Preview Quick Action to ~/Library/Services/

If the Quick Action doesn't appear immediately in Finder, log out and back in.

Usage

Quick Action: right-click one or more PDFs in Finder → Quick Actions → Convert PDF for Preview. A _converted.pdf file appears alongside each original.

Command line:

bash convert_pdf.sh file1.pdf file2.pdf

How it works

  1. pypdfium2 (built with V8/XFA support) renders each PDF page at 288 DPI
  2. img2pdf assembles the rendered pages into a standard PDF
  3. The output is a flat image-based PDF with no XFA or Adobe-specific dependencies

The key requirement is that pypdfium2 is built from source with PDFIUM_PLATFORM=auto-v8, which downloads a pdfium binary compiled with V8 (the JavaScript engine XFA depends on). The standard PyPI wheel omits V8 to reduce size.

Project structure

pdf_tool/
├── convert_pdf.py                        # core conversion logic
├── convert_pdf.sh                        # shell wrapper (used by Quick Action)
├── setup.sh                              # one-time setup for a new Mac
├── pyproject.toml                        # uv project + dependency config
├── uv.lock                               # pinned dependency versions
└── Convert PDF for Preview.workflow/     # Automator Quick Action bundle