Dansk

ubl-tools

Read UBL e-invoices (Peppol BIS 3.0 and OIOUBL) in the terminal or as a printable page, and pull out the attached PDF. Everything happens on your own machine.

Language
Rust
Licence
MIT OR Apache-2.0
Runs on
Linux, macOS, Windows

An e-invoice is an XML file. Reading one means scrolling through a few hundred lines of cbc: and cac: elements, or uploading it to an online viewer. The viewers work, but they want the whole invoice, and that includes names, VAT numbers, bank details and what the customer bought. I’m not keen on sending all that to a stranger’s server just to read it.

So I wrote ubl. It reads the file locally and shows it as an ordinary invoice: seller and buyer with their identifiers named properly (CVR, GLN, VAT numbers and Peppol endpoint IDs instead of bare scheme codes like 0184), the lines with quantity, unit, price and VAT, the VAT breakdown per category and the totals. Payment details come along too, including Danish FI cards in the familiar +71<…+…< notation. If the invoice is wrapped in a Peppol envelope (SBDH), it unwraps it by itself.

It understands Peppol BIS Billing 3.0, OIOUBL 2.1 (the Danish NemHandel format) and other EN 16931 invoices and credit notes. OIOUBL has a small trap where TaxExclusiveAmount is actually the VAT amount and not the amount before VAT.. ubl knows about it, so the totals add up.

Install

On Arch Linux it’s on the AUR, as a source package and as a prebuilt binary:

yay -S ubl-tools        # builds from source
yay -S ubl-tools-bin    # prebuilt binary

On macOS from my Homebrew tap:

brew tap asger-weirsoee/tap
brew install ubl-tools

On Windows 10/11 with Scoop:

scoop install https://asger.weirsoe.dk/tarballz/ubl-tools.json

You can also grab the zip from tarballz and unpack it. The binary isn’t code signed, so Windows may ask before the first run.

Usage

ubl view invoice.xml               # in the terminal
ubl view invoice.xml --open        # as a page in the browser
ubl view invoice.xml --lang da     # Danish labels
ubl extract invoice.xml other.xml  # save the PDF next to each file
ubl extract *.xml -o ./bilag       # or all of them into one folder
ubl open invoice.xml               # save attachments, open in browser

ubl extract never overwrites anything. An identical file that’s already there is reused, and a different one gets a new name. On Windows you can drop one or more XML files straight onto ubl.exe in Explorer: the PDFs are saved, the invoices open, and the window stays until you’ve read the result.

The HTML page is a single self-contained file with no external requests, laid out for A4 so it prints cleanly.