Bulk convert pub files to Word or PDF without Publisher
To bulk convert pub files without Publisher, choose them all at once in the free tool on this site: it runs in your browser, installs nothing and gives you one zip with a PDF and a Word file for each. For very large archives or automation, install LibreOffice (free) and run one of the two short scripts below. We tested both scripts on Linux only, with one sample file.
Fastest: convert many files in your browser
Open the PUB file viewer and choose several .pub files at once. It gives you one zip with a PDF and a Word file (.docx) for each. There is nothing to install and no account, it is free, and the files are never uploaded: they are read on your own device. If you want only the Word files, the Publisher to Word tool does the same.
It uses the same reader as LibreOffice (libmspub), so Publisher 2000 and later work best and Publisher 95 to 98 only partly (libmspub wiki). We tested it on 19 sample files, mostly small test files plus one real four-page newsletter, not on a large archive, so try a few files first and compare the results with the originals. For a very large archive, or to run the job automatically, use the scripts below.
Before you start (for the scripts)
- Copy the folder. The scripts only read your .pub files, and our test record says the originals were unchanged, but a copy costs nothing.
- Check free disk space. Every .pub file gets a PDF next to it in the converted folder. In our test the PDF of a two-page file was about 14 KB, but yours may be much larger.
- Try one file first. Put one or two files in a test folder, run the script, and open the PDFs before you do the whole archive.
- Start from an empty converted folder. The scripts print OK when a PDF with the right name exists, so an old PDF left over from an earlier run would show OK even if this run failed. Delete the converted folder before you run a script again.
- Know what you get. The result is a PDF for reading and printing, not an editable file.
What you need: LibreOffice
LibreOffice is a free, open source office suite (LibreOffice’s download page). Its own site offers it for Windows, macOS and Linux (download options). Install it from there. That page now offers LibreOffice 26.8.2 first, a newer version than the 26.2.6.3 we tested. The scripts call LibreOffice without opening its windows, which is what the word “headless” means in the script.
LibreOffice reads .pub files with a library called libmspub. That library supports Publisher 2000 and later, and its support for Publisher 95 to 98 files is limited (libmspub wiki). If your archive has very old files, expect some of them to fail or to look wrong.
Mac and Linux: convert-pub-files.sh
- Install LibreOffice from the download page above.
- Save the script below as a plain text file named
convert-pub-files.sh, for example in your Downloads folder. - Open Terminal.
- Run the script with the path of your folder in quotes. If you are in the folder where you saved it:
bash convert-pub-files.sh "/path/to/folder" - Wait for it to finish. It prints one line per file. Open the new
convertedfolder inside your folder to see the PDFs.
You can give a second path to save the PDFs somewhere else. The script is written to look for LibreOffice at/Applications/LibreOffice.app/Contents/MacOS/soffice on a Mac, but we did not test on a Mac, so that part is unproven.
#!/usr/bin/env bash
# Convert every .pub file in a folder to PDF with LibreOffice. The original files are not changed.
# Usage: bash convert-pub-files.sh "/path/to/folder" ["/path/to/output"]
set -u
src=${1:?Give the folder that holds your .pub files}
out=${2:-"$src/converted"}
soffice=$(command -v soffice || echo /Applications/LibreOffice.app/Contents/MacOS/soffice)
mkdir -p "$out"
find "$src" -maxdepth 1 -type f -iname '*.pub' -print0 | while IFS= read -r -d '' f; do
name=$(basename "$f"); base=${name%.*}
if "$soffice" --headless --convert-to pdf --outdir "$out" "$f" >/dev/null 2>&1 && [ -s "$out/$base.pdf" ]; then
echo "OK $name"
else
echo "FAIL $name"
fi
done
Windows: Convert-PubFiles.ps1
- Install LibreOffice from the download page above.
- Save the script below as a plain text file named
Convert-PubFiles.ps1. In Notepad, choose “All files” as the type when you save, so Windows does not add .txt. - Open PowerShell in the folder where you saved the script.
- Run the command from the script’s usage line, with your own folder in place of the example:
powershell -ExecutionPolicy Bypass -File .\Convert-PubFiles.ps1 -Folder "C:\Users\you\Documents\Newsletters" - Wait for it to finish. It prints one line per file, and the PDFs appear in a
convertedfolder inside your folder.
About -ExecutionPolicy Bypass: Windows normally blocks PowerShell script files you have saved yourself. That option lets this one script run for this one command, without changing the computer’s settings. Read the script before you run it; it is short and is shown in full below. We ran the Windows script with PowerShell 7.6.9 on Linux, not with the Windows PowerShell that comes with Windows, so we cannot say how it behaves there.
The script looks for LibreOffice at C:\Program Files\LibreOffice, and if it is not there it tries the plain command soffice. That is LibreOffice’s default install location as far as we know, but we have not checked it ourselves.
# Convert every .pub file in a folder to PDF with LibreOffice. The original files are not changed.
# Usage: powershell -ExecutionPolicy Bypass -File .\Convert-PubFiles.ps1 -Folder "C:\Users\you\Documents\Newsletters"
param(
[Parameter(Mandatory = $true)][string]$Folder,
[string]$Out = (Join-Path $Folder 'converted')
)
$soffice = 'C:\Program Files\LibreOffice\program\soffice.exe'
if (-not (Test-Path -LiteralPath $soffice)) { $soffice = 'soffice' }
New-Item -ItemType Directory -Force -Path $Out | Out-Null
Get-ChildItem -LiteralPath $Folder -File | Where-Object { $_.Extension -ieq '.pub' } | ForEach-Object {
& $soffice --headless --convert-to pdf --outdir $Out $_.FullName | Out-Null
$pdf = Join-Path $Out ($_.BaseName + '.pdf')
if (Test-Path -LiteralPath $pdf) { "OK $($_.Name)" } else { "FAIL $($_.Name)" }
}
What the output looks like
Each file gets one line: OK when a PDF with the right name exists, FAIL when it does not. A .pub file that fails stays where it is. Files that do not end in .pub are skipped (our test record says a .txt file was skipped). The scripts do not go into subfolders, so run them once per folder.
OK Parish Newsletter.pub
OK flyer.PUBThat is the output from our test. An OK line means a PDF file exists, not that the PDF looks right. Open a few and compare them with the originals.
What we tested
| Script | What we ran | What we did not do |
|---|---|---|
| convert-pub-files.sh | LibreOffice 26.2.6.3 on Linux. Our one sample file, copied under two names: "Parish Newsletter.pub" (with a space) and "flyer.PUB" (upper-case ending), plus a .txt file. Both .pub files got OK. The test record says the .txt file was skipped and the originals were unchanged; the raw output shows only the two .pub files converted. | No Mac, so the Mac path detection in the script is untested. No real archive. One file is not a study. |
| Convert-PubFiles.ps1 | PowerShell 7.6.9 on Linux, same folder contents, same result: OK for both files. Not Windows PowerShell 5.1. | Not run on Windows itself. The LibreOffice path in it is the default install path, which we did not verify. |
The sample file was a two-page A4 file. In the same test, its first page held Russian text, and on the rendered PDF page it came out garbled. So older files with non-Latin text can come out garbled; ours did, and its conversion still got an OK line. The script cannot tell you about that.
Publisher files to Word
Our browser tool saves a .pub file as Word (.docx) with editable text; the layout becomes a Word flow, with text boxes as paragraphs in reading order. LibreOffice can’t save a .pub file as Word directly: in our test with one file it had no Word export for it and reported “no export filter”. LibreOffice’s own guide lists the OpenDocument Drawing formats and picture formats for Draw, and does not list Word (Getting Started Guide 7.5, chapter 10), so the scripts make PDFs.
Microsoft’s route to Word is a PDF first: open the PDF in Word. Microsoft says the converted Word document is optimized for text editing, so the layout may differ from the original, especially with many graphics (Microsoft’s support article). That is the same route you can take with the PDFs these scripts make, one file at a time, if you would rather not use our tool.
If you still have Publisher
Microsoft’s support article has its own sample script for exporting many files to PDF, but it needs a working, licensed copy of Publisher installed on the computer (Microsoft’s support article). That is for people who still have Publisher. The scripts on this page are for everyone else. To convert one file by hand in LibreOffice, see its help on PDF export.
Whichever route you use, keep the original .pub files. A PDF cannot be edited the way a Publisher file can. For opening a single file, see how to open a .pub file without Publisher.
Common questions
- Can you convert PUB to PDF?
- Yes. Our browser tool saves a PDF of one file, or a zip with a PDF and a Word file for each of many files. In our test with one file on Linux, LibreOffice also saved a PDF, and both scripts on this page made a PDF for each .pub file in a folder. We have not tried a large archive.
- How can I convert a Publisher file to Word for free?
- Our browser tool does it, one file or many: you get Word files with editable text, though the layout becomes a Word flow. LibreOffice had no Word export for a .pub file in our test with one file. Microsoft's route is a PDF first, and its own bulk script needs a licensed copy of Publisher.
- How to save a PUB file as a PDF?
- With Publisher, choose File > Save as and pick PDF. Without it, the scripts on this page call LibreOffice to do it for a whole folder. For one file, LibreOffice's help gives File > Export As > Export as PDF.
Last checked: