Page Design -> Create PDF and XML

Cloud Enterprise

Hi all,

We create invoices in our system using Page Design. In Germany, it is now law to send human-readable PDFs and machine-readable XML files.

Could someone give me some pointers on how to create XML export files? The ideal situation would be to have a button that creates both a PDF and an XML file upon clicking. This would presumably require a script that coud not only take information from a table row (company, service details) but also includeinvoicing company details (address, name, IBAN, etc.).

Hi @webdienste, how are you?

I took some time to look at your problem, and it seems that it’s now mandatory (or about to become so) to send an electronic invoice in Germany but also in France (it’s apparently a European decision so I imagine that eventually it will be the case for all of Europe).

When I looked it up on the net, I found that the Factur-x format (also known as ZUGFeRD in Germany) seems to be pretty widespread for this type of invoice; it’s actually a pdf file with the XML file attached (on the website, you’ll find full documentation in German, French and English).

For your case, I think the ideal scenario might look something like this:

  1. You generate the usual pdf invoice
  2. Either the same action or an automation triggered by the creation of the invoice pdf file (if your store it in your table) runs a script that will create, from the data in your database, the corresponding XML file (and eventually store it as well)
  3. The Factur-x file is created from both the pdf invoice and the XML file.

For this third step, I found a Factur-x python library that seems to do the job. This python library is not actually present in the SeaTable python interpreter, but maybe this is something you can ask @cdb or @rdb for, or you could use another solution like running this script from replit or another similar service…

The second step is still more complex as far as I understand it, because I didn’t find yet any library able to do this step for you. Of course, generating an xml file from a python script is no big deal, but of course this XML file will have to be compliant with the official Factur-x XSD (XML Schema Definition) which is actually neither unique (Minimum, Basic WL, Basic, EN16931 and Extended) nor easy to find/understand…

In my humble opinion, the better way to generate this XML file from your actual data is to:

  1. Define which data profile seems to be the most appropriate for you (descriptions below come from the fnfe-mpe website cited above):
    • MINIMUM: corresponding to the minimum invoice information required on CHORUSPRO and equivalent to a classic header OCR and manual validation data capture.
    • BASIC WL: corresponding to the document level invoice information that are mostly required or useful for buyers for their process automation
    • BASIC: corresponding to the BASIC WL profile with the core line information required or useful for buyers for their process automation
    • EN16931: corresponding to all the invoice information present in the European Norm EN16931
    • EXTENDED: corresponding to the EN16931 profile, with some additional invoice data. This profile is under construction, and will be published later.
  2. Once you chose the data profile, find in the full documentation an invoice example pretty similar to the ones you actually generate so you can get the corresponding XML file
  3. Develop a python script (or find someone to develop it for you :wink:) able to generate a similar XML file from your data stored in SeaTable

PS: two other formats exist for electronic invoices: Universal Business Language (UBL) and Cross Industry Invoice (CII).

Bests,
Benjamin


I love spending time gathering information and explaining solutions to help you solve your problems. I spend… quite a bit of time on it :sweat_smile: .If you feel grateful for the help I’ve given you, please don’t hesitate to support me. I am also available for paid services (scripts, database architecture, custom development, etc.).

3 Likes

HI Benn,

Wow, thank you so much for your very detailed answer. There is so much there to digest and I will look into it as soon as I have more time.

I do know of standalone (free) software that allows the creation of PDF/A and XML invoices in one but this would mean having to abandon using SeaTable as it would create more of a headache.

I hope that SeaTable will consider this for the future. I got an email from a large customer announcing that only Zugpferd 2.0-compliant invoices will be accepted. Other customers haven’t demanded it yet, but it is only a matter of time.

I will get back to you!

Just added my vote to the idea in teh ideas forum: SeaTable Feature Requests Board