Converts Microsoft Publisher (.pub) files to PDF.
Two deliverables in this repo:
pub2pdf.py— script with two engines, auto-detected (see table below)- standalone app — fully self-contained, no Office, no LibreOffice, no
Python needed: libmspub 0.1.4 + librevenge 0.0.5 (compiled with MinGW-w64),
svg2pdf (Rust/resvg), and a PyInstaller orchestrator
(
standalone/pub2pdf_app.py). It is not committed — CI builds it on eachv*tag and publishes the zip to Releases. To build it yourself, see BUILD.md. Double-clickpub2pdf.exeto open the GUI (queue files/folders, pick where PDFs go, watch a progress bar) — or pass a path on the command line for the same batch conversion headless. Ideal for migrating a whole folder of.pubfiles at once with no install.
| Engine | Needs | Fidelity |
|---|---|---|
publisher |
MS Publisher + pywin32 (Windows) |
Pixel-identical — drives Publisher's own "Save as PDF" via COM |
libreoffice |
LibreOffice (free, any OS) | Approximate — LibreOffice re-renders the layout with its libmspub filter |
| standalone app | nothing | Approximate — same libmspub parser as LibreOffice, rendered via resvg |
Auto-detection prefers Publisher when installed, otherwise falls back to
LibreOffice (soffice on PATH or in the standard install directory).
So the same script works on machines without any Microsoft Office install —
just install LibreOffice there.
pub2pdf <path> [options]
path a .pub file or a directory containing .pub files
-o, --output-dir D write PDFs into D (default: next to each source file)
-r, --recurse when path is a directory, also search subdirectories
-f, --force overwrite existing PDFs instead of skipping
-e, --engine E auto (default) | publisher | libreoffice
Examples:
pub2pdf newsletter.pub
pub2pdf C:\flyers --recurse --output-dir C:\flyers\pdf
pub2pdf C:\flyers --engine libreoffice --force
Exit code is 1 if any file failed to convert, 0 otherwise.
Note: this is a Python tool on purpose —
powershell.exeis blocked by group policy on this machine, so a.ps1converter would not run. Run it viapyor thepub2pdf.cmdwrapper.
- Publisher's COM
Openrejects the documentedReadOnly/SaveChangesarguments for.pubfiles withE_INVALIDARG; the script opens with the path only and never saves, so source files are not modified. - With the
publisherengine, Publisher briefly starts in the background (one instance reused across the whole batch). Close any interactive Publisher session with unsaved work before running large batches. - The
libreofficeengine starts onesofficeprocess per file; large batches are slower but require no Office license. - LibreOffice fidelity caveats: complex Publisher layouts (linked text boxes, WordArt, master pages) may shift or simplify. Spot-check output when the source design matters.