Independent product studio · Swedenhello@karelialabs.com

Guide

How to batch convert Publisher (.pub) files to PDF, sub-folders included

Short answerInstall the free LibreOffice, paste one PowerShell command, and every .pub file under a folder becomes a PDF in a matching folder tree. For thousands of files, PNG pages or a list of what failed, use PUB Lifeboat.

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

  1. Open Windows PowerShell: press Start, type PowerShell and press Enter.
  2. 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.
  3. 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).Count

Then 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

More from Karelia Labs