Balsoft.Hive.EInvoice
1.0.0
Prefix Reserved
dotnet add package Balsoft.Hive.EInvoice --version 1.0.0
NuGet\Install-Package Balsoft.Hive.EInvoice -Version 1.0.0
<PackageReference Include="Balsoft.Hive.EInvoice" Version="1.0.0" />
<PackageVersion Include="Balsoft.Hive.EInvoice" Version="1.0.0" />
<PackageReference Include="Balsoft.Hive.EInvoice" />
paket add Balsoft.Hive.EInvoice --version 1.0.0
#r "nuget: Balsoft.Hive.EInvoice, 1.0.0"
#:package Balsoft.Hive.EInvoice@1.0.0
#addin nuget:?package=Balsoft.Hive.EInvoice&version=1.0.0
#tool nuget:?package=Balsoft.Hive.EInvoice&version=1.0.0
Balsoft.Hive.EInvoice
Electronic invoices for .NET that pass the official validators: XRechnung 3.0, ZUGFeRD 2.5 / Factur-X 1.09, Peppol BIS 3.0 and plain EN 16931, written and read as CII and UBL, and embedded into PDF/A-3 hybrid invoices.
- A model that speaks EN 16931. Every property is named after its business term and
documented with its number (
BuyerReferenceis BT-10,Selleris BG-4). - Totals you cannot get wrong. Line net amounts, document totals and the VAT breakdown are calculated from the lines exactly as EN 16931 prescribes: rounding per VAT category, allowances and charges, prepaid and rounding amounts.
- Rules before sending. A pre-flight check reports what a receiver's validator would
reject, with the official rule id:
[BR-DE-15] XRechnung requires the buyer reference. - Read what you receive. CII and UBL readers turn incoming documents back into the model, and report where the sender's totals disagree with EN 16931.
- Hybrid PDFs.
Balsoft.Hive.EInvoice.Pdfturns your ERP's PDF into a PDF/A-3b with the XML attached, Factur-X XMP metadata and missing fonts embedded. - Tested against the real thing. Every build validates the samples with the KoSIT validator (XRechnung 3.0.2 configuration, CII and UBL) and with Mustang (Factur-X profiles, PDF/A-3 via veraPDF).
| Package | Dependencies | Targets |
|---|---|---|
Balsoft.Hive.EInvoice |
none | netstandard2.0, net8.0 |
Balsoft.Hive.EInvoice.Pdf |
Balsoft.Hive.EInvoice, PDFsharp (MIT) |
netstandard2.0, net8.0 |
Install
dotnet add package Balsoft.Hive.EInvoice
dotnet add package Balsoft.Hive.EInvoice.Pdf # only for hybrid PDF invoices
Write an XRechnung
using Balsoft.Hive.EInvoice;
using Balsoft.Hive.EInvoice.Cii;
var invoice = new Invoice
{
Number = "RE-2026-0001",
IssueDate = new DateTime(2026, 9, 15),
DueDate = new DateTime(2026, 10, 15),
BuyerReference = "04011000-12345-34", // Leitweg-ID, BT-10
Seller = new Party
{
Name = "Balsoft GmbH",
VatIdentifier = "DE452983132",
ElectronicAddress = new SchemedIdentifier("invoice@balsoft.de", ElectronicAddressScheme.Email),
Address = new PostalAddress { Line1 = "Herler Str. 109", PostCode = "51067", City = "Köln", CountryCode = "DE" },
Contact = new Contact { Name = "Buchhaltung", Phone = "+49 221 1234567", Email = "buchhaltung@balsoft.de" },
},
Buyer = new Party
{
Name = "Stadt Musterstadt",
ElectronicAddress = new SchemedIdentifier("04011000-12345-34", ElectronicAddressScheme.LeitwegId),
Address = new PostalAddress { Line1 = "Rathausplatz 1", PostCode = "53111", City = "Bonn", CountryCode = "DE" },
},
PaymentInstructions = PaymentInstructions.SepaCreditTransfer("DE89 3704 0044 0532 0130 00"),
};
invoice.AddLine(new InvoiceLine("Beratung", 10m, UnitCode.Hour, 120m, 19m));
invoice.CashDiscounts.Add(new CashDiscount { Days = 7, Percent = 2m }); // written as #SKONTO#
byte[] xml = CiiWriter.Write(invoice, InvoiceProfile.XRechnung);
The same invoice as UBL, or as a hybrid PDF from your ERP's printout:
byte[] ubl = UblWriter.Write(invoice, InvoiceProfile.XRechnung);
byte[] pdf = HybridPdf.Create(File.ReadAllBytes("RE-2026-0001.pdf"), invoice, InvoiceProfile.EN16931);
CiiWriter and UblWriter check the invoice first and throw InvoiceValidationException
listing every violated rule. To check without writing:
var result = InvoiceValidator.Validate(invoice, InvoiceProfile.XRechnung);
foreach (var issue in result.Issues)
Console.WriteLine(issue); // [BR-DE-6] XRechnung requires the seller contact telephone number. (BT-42)
Read an incoming invoice
using Balsoft.Hive.EInvoice.Reading;
var read = InvoiceReader.Read(File.ReadAllBytes("incoming.xml")); // CII or UBL, detected
Console.WriteLine($"{read.Syntax} {read.Profile}: {read.Invoice.Number} from {read.Invoice.Seller.Name}");
foreach (var difference in read.TotalsDiscrepancies())
Console.WriteLine(difference); // "BT-115 stated 100.00, calculated 100.01"
var fromPdf = HybridPdf.ReadInvoice(File.ReadAllBytes("incoming.pdf")); // ZUGFeRD / Factur-X / XRechnung PDF
Profiles
InvoiceProfile |
Specification | CII | UBL | Validated in CI by |
|---|---|---|---|---|
XRechnung |
XRechnung 3.0 (German CIUS) | yes | yes | KoSIT, XRechnung scenarios |
EN16931 |
EN 16931, Factur-X / ZUGFeRD "EN 16931" | yes | yes | KoSIT, EN 16931 scenarios |
FacturXExtended |
Factur-X / ZUGFeRD EXTENDED (EN 16931 content) | yes | Mustang | |
FacturXBasic |
Factur-X / ZUGFeRD BASIC | yes | Mustang | |
FacturXBasicWL |
Factur-X / ZUGFeRD BASIC WL (no lines) | yes | Mustang | |
FacturXMinimum |
Factur-X / ZUGFeRD MINIMUM (no lines) | yes | Mustang | |
PeppolBis3 |
Peppol BIS Billing 3.0 | yes | yes | pre-flight Peppol rules |
Hybrid PDFs are written for every Factur-X profile and XRechnung, and validated as PDF/A-3b by veraPDF inside Mustang.
What the pre-flight check covers
The EN 16931 core rules (BR-01 to BR-65), the VAT category rules (BR-S, BR-Z, BR-E, BR-AE, BR-IC, BR-G, BR-O), the code lists (BR-CL, extracted from the official artefact), and for XRechnung the German rules (BR-DE) plus the Peppol rules XRechnung 3.0 includes. The test suite breaks valid invoices in 31 specific ways and asserts that the pre-flight reports the same rule id as the KoSIT validator. Where the pre-flight is stricter than the official artefact (BR-CL-23 is shadowed in the CII Schematron and never fires), a test documents it. The official validators remain authoritative.
Hybrid PDF details
- Pages are taken from the carrier PDF unchanged; the XML is attached as
xrechnung.xmlorfactur-x.xmlwith relationshipAlternative(Datafor MINIMUM and BASIC WL). - XMP metadata declares PDF/A-3 conformance B and carries the Factur-X extension schema (DocumentType, DocumentFileName, Version, ConformanceLevel).
- The sRGB output intent profile is generated from the IEC 61966-2-1 definition by
eng/icc/make_srgb_icc.py, so the package ships no third-party ICC file. - TrueType fonts the carrier uses without embedding them are embedded from the system font folders, found by PostScript name. Type 1 fonts cannot be embedded this way and are logged.
Code lists
CodeList.IsUnitCode("HUR"), CodeList.IsCountryCode("DE") and the other lookups use the
lists embedded in the EN 16931 validation artefact, regenerated with
eng/codelists/extract_codelists.py whenever KoSIT publishes a new configuration.
Building and testing
dotnet test
The external validation tests need Java 21 and the validators:
bash eng/get-validators.sh # KoSIT validator, XRechnung configuration, Mustang
export HIVE_VALIDATORS=$PWD/.tools/validators
dotnet test
Specifications
EN 16931-1:2017, XRechnung 3.0.2 (KoSIT, validator configuration 2026-08-31), ZUGFeRD 2.5 / Factur-X 1.09 (FeRD / FNFE-MPE, June 2026), Peppol BIS Billing 3.0, UN/CEFACT CII D16B, OASIS UBL 2.1, ISO 19005-3 (PDF/A-3).
License
Apache License 2.0. Copyright Balsoft GmbH. Maintained by Ertugrul Balveren (Balsoft GmbH). It is the e-invoice engine of Hive DocFlow. Packages are author-signed by Balsoft GmbH; see SECURITY.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Balsoft.Hive.EInvoice:
| Package | Downloads |
|---|---|
|
Balsoft.Hive.EInvoice.Pdf
Hybrid e-invoices for Balsoft.Hive.EInvoice: embeds the XRechnung or ZUGFeRD / Factur-X XML into a PDF/A-3 (Factur-X XMP metadata, sRGB output intent, associated file relationship), repairs common carrier PDF defects and embeds missing fonts. Reads the XML back out of a hybrid PDF. Built on PDFsharp (MIT). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 221 | 9/23/2026 |
| 0.1.0-preview.1 | 65 | 9/23/2026 |