Skip to content
arbitrary-stringPublic

About

Convert Microsoft Publisher (.pub) files to Word (.docx) documents that keep the same layout

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Publisher to Word Converter (pub2word)

Turns Microsoft Publisher (.pub) files into Word (.docx) documents that keep the same page size, positions, fonts, colours, pictures and shapes.

The converter window

  • Editable layout (default): every text box, picture and shape is placed at the same spot and stays editable in Word. Anything Word can't draw the same way is kept in a picture behind them.
  • Editable text on a page picture: artwork and shapes become one picture; text boxes stay editable on top.
  • Exact picture of each page: looks the same, but nothing can be edited.
  • Fonts installed on the computer can be packed into the Word file, and missing fonts are listed.
  • Before-and-after previews of every page.

The program runs entirely on your computer and never connects to the internet. It uses LibreOffice in the background to read the Publisher file.

Install

Ubuntu / Debian (22.04 or newer, 64-bit)

Download pub2word_1.0.0_amd64.deb from the latest release and install it with apt, which also installs LibreOffice if it's missing:

wget https://github.com/arbitrary-string/pub2word/releases/download/v1.0.0/pub2word_1.0.0_amd64.deb
sudo apt install ./pub2word_1.0.0_amd64.deb

Then open Publisher to Word Converter from your app list, or run pub2word. To remove it: sudo apt remove pub2word.

Windows 10 / 11 (64-bit)

  1. Install the free LibreOffice.
  2. Download pub2word-1.0.0-windows-x64.exe from the latest release and double-click it. It doesn't need installing and never asks for administrator rights.

The program isn't code-signed, so SmartScreen may say "Windows protected your PC" the first time: choose More info, then Run anyway. You can check the download against SHA256SUMS.txt with Get-FileHash pub2word-1.0.0-windows-x64.exe -Algorithm SHA256 in PowerShell.

Command line

pub2word [FILES.pub…] [--auto]          open the window (optionally with files; --auto starts converting)
pub2word --convert IN.pub OUT.docx [--mode editable|text|picture] [--no-fonts] [--previews]

How it works

  1. LibreOffice (soffice --headless) opens the .pub file and saves it as a flat OpenDocument drawing (.fodg).
  2. pub2word reads that drawing into a page model: text boxes with their paragraphs and character styles, pictures, and shapes with their outlines, fills, lines and shadows.
  3. Whatever can't be rebuilt as a Word object is drawn into a page picture (through LibreOffice, and pdftoppm when installed).
  4. The .docx is written directly: each object is anchored to the page at its exact position, with the page picture behind, and fonts embedded when requested.

Known limitations

  • Fonts that aren't installed on the converting computer can't be embedded. The Word file still asks for them by name, so they appear on any computer that has them.
  • Tables, WordArt, cropped pictures and slanted shapes haven't been tested with real Publisher files; they are kept in the page picture, so the page should still look right but those parts won't be editable.
  • The Windows build is cross-compiled on Linux and hasn't been tested yet on a real Windows PC.

Building from source

Needs Rust, plus cargo-zigbuild and Zig for the release builds.

cargo build --release              # a quick local build: target/release/pub2word
packaging/build-deb.sh             # dist/pub2word_VERSION_amd64.deb (works on Ubuntu 22.04+)
./build-windows.sh                 # dist/windows/pub2word.exe (needs: rustup target add x86_64-pc-windows-gnu)
./build-linux.sh                   # a portable folder in dist/linux with a double-click launcher

License

GNU General Public License v3.0 or later. See LICENSE.

About

Convert Microsoft Publisher (.pub) files to Word (.docx) documents that keep the same layout

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages