Skip to content

Instantly share code, notes, and snippets.

@passsy
Last active April 16, 2024 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passsy/e87a3873d41865f33033203fa6337ffe to your computer and use it in GitHub Desktop.
Save passsy/e87a3873d41865f33033203fa6337ffe to your computer and use it in GitHub Desktop.
How to use xrechnung-visualization

How to use xrechnung-visualization

1. Install Ant

Install brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Then install ant using brew

brew install ant

2. Run ant

Go into xrechnung-visualization repo and run ant (may take a few minutes)

cd xrechnung-visualization
ant

The ant scripts will download all tools required to execute the transformations

Once download, you'll find a lot of files in the newly created /build folder.

3. Transform CIUS XRechnung to HTML or PDF

We're using SAXON, a open-source XSLT processor (saxon9he.jar) which was downloaded by the ant script. It uses the xsl style sheets in the repository to style the XML files.

You can run java -jar lib/saxon9he.jar to get more informations how it works

First we have to convert the XML first into the intermediate .xr format.

java -jar lib/saxon9he.jar -s:path/to/Rechnung.xml -xsl:src/xsl/ubl-invoice-xr.xsl -o:out/Rechnung.xr

Generate HTML

java -jar lib/saxon9he.jar -s:out/Rechnung.xr -xsl:src/xsl/xrechnung-html.xsl -o:out/Rechnung.html

Generate PDF

java -jar lib/saxon9he.jar -s:out/Rechnung.xr -xsl:src/xsl/xr-pdf.xsl -o:out/Rechnung.pdf 
@ryder-hook
Copy link

Did not work anymore. Creation of PDF did not work. PDF file is corrupted. Anyway HTML file creation worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment