How to batch convert Publisher (.pub) files to PDF, sub-folders included
Updated
Before you start
- The command only reads your .pub files and writes the PDFs into a new folder. The originals are not changed.
- Install the free LibreOffice. Its Publisher reader does the conversion.
- Close LibreOffice before you run the command. While it is open, the conversion quietly does nothing.
Convert every .pub file under a folder
- Open Windows PowerShell: press Start, type PowerShell and press Enter.
- Change the paths in the first two lines below: your archive, and a new, empty folder for the PDFs. Write them without a backslash at the end.
- Paste all the lines into PowerShell and press Enter. Each file takes a few seconds.
$src = "D:\Old newsletters"
$dst = "D:\Converted"
$soffice = "C:\Program Files\LibreOffice\program\soffice.com"
Get-ChildItem $src -Recurse -Filter *.pub | ForEach-Object {
$out = Join-Path $dst $_.DirectoryName.Substring($src.Length)
New-Item -ItemType Directory -Force $out | Out-Null
& $soffice --headless --convert-to pdf --outdir $out $_.FullName | Out-Null
}The PDFs land in the same sub-folders under the new folder, with the same names as the .pub files.
Tested on 13 November 2026 on Windows 11 with LibreOffice 26.8.2 and public sample files: four files in two sub-folders took about 22 seconds, the folder structure was kept, and a file in the top folder works too.
Check the result
The command does not report files that failed, so compare the counts. Run these two lines in the same PowerShell window; both numbers should match:
(Get-ChildItem $src -Recurse -Filter *.pub).Count
(Get-ChildItem $dst -Recurse -Filter *.pdf).CountThen open a few PDFs of each kind. Simple flyers, letters and certificates usually look right; newsletters with stories running through linked text boxes can shift. The guide How to open .pub files without Publisher lists what to expect.
Limits of the free command
- One file that makes LibreOffice hang stops the whole run until you close LibreOffice in Task Manager.
- There is no list of failed files and no PNG pages.
- Running it again converts every file again; it cannot pick up where it stopped.
Thousands of files: PUB Lifeboat
PUB Lifeboat does the same conversion in a window instead of a command: pick a folder, tick PDF and/or PNG and press Start. It keeps the folder structure, skips files that are already done, stops files that hang and writes a CSV report of every file. The first 10 files are free in full quality with the free trial; a licence is $14, or $29 with editable SVG and ODG.
FAQ
Can I convert to Word instead of PDF?
Not in a useful way. LibreOffice opens .pub files in Draw, which saves PDF, PNG, SVG and its own ODG format but not Word documents. Microsoft suggests converting to PDF and opening the PDF in Word, with a warning that the layout may shift.
How long does it take?
A few seconds per file on a normal PC, because LibreOffice starts once for every file. In our test four files took about 22 seconds.
Does it work on a Mac?
LibreOffice for Mac has the same Publisher reader and command-line options, but this command is for Windows PowerShell, and we have not tested a Mac version.
More guides
How to open .pub files without Publisher after October 2026
Your .pub files are not gone, only the program that opened them. Open them in the free LibreOffice Draw one at a time, or convert whole folders to PDF with LibreOffice's command line or PUB Lifeboat.
Read the guide →Microsoft Publisher alternatives in 2026: which ones open your .pub files
To keep editing, the free Affinity app says it imports .pub files, and LibreOffice Draw and Scribus open them with the same open-source reader. Word and PowerPoint, Microsoft's own suggestions, cannot open .pub files: convert to PDF first. For a whole archive, convert everything to PDF in one go.
Read the guide →Fix Paymenter after upgrading to Pterodactyl 2.0: "api/application/nests could not be found"
Pterodactyl 2.0 removed the nest endpoints that Paymenter's built-in extension calls. Switch to a 2.0-aware extension with one command; products and services stay.
Read the guide →