invoice4j is a modular, open-source Java library for creating, reading, validating, and converting electronic invoices.
The project provides support for multiple e-invoicing standards, including ZUGFeRD, Factur-X, XRechnung, and PEPPOL BIS.
Status: Early development
- EN 16931 compliant domain model
- ZUGFeRD / Factur-X support
- XRechnung support
- Built-in invoice calculation engine
- XML validation
- Pure Java, no external services
- UN/CEFACT CII
- ZUGFeRD
- XRechnung
- UBL (planned)
- PEPPOL (planned)
invoice4j contains a built-in calculation engine that automatically derives invoice totals according to EN 16931.
- Calculates invoice line totals (BT-131)
- Supports fixed and percentage discounts
- Supports line and document level allowances/charges
- Calculates VAT breakdowns (BG-23)
- Calculates invoice monetary summation (BG-22)
- Centralized monetary arithmetic and rounding
- Validates calculation consistency
- Java 23 or later
<dependency>
<groupId>io.github.jcodeforge</groupId>
<artifactId>invoice4j-zugferd</artifactId>
<version>0.4.0</version>
</dependency>
<dependency>
<groupId>io.github.jcodeforge</groupId>
<artifactId>invoice4j-xr</artifactId>
<version>0.4.0</version>
</dependency>Only add the module(s) you need. Both modules automatically include the shared invoice4j-base dependency.
implementation("io.github.jcodeforge:invoice4j-zugferd:0.4.0")
implementation("io.github.jcodeforge:invoice4j-xr:0.4.0")implementation 'io.github.jcodeforge:invoice4j-zugferd:0.4.0'
implementation 'io.github.jcodeforge:invoice4j-xr:0.4.0'invoice4j-zugferd supports ZUGFeRD and Factur-X documents. invoice4j-xr supports XRechnung. Both modules automatically include the shared core library.
Complete runnable examples are available here:
invoice4j-base/src/main/java/io/github/jcodeforge/invoice4jbase/examples/QuickStart.java
invoice4j-zugferd/src/main/java/io/github/jcodeforge/invoice4jzugferd/examples/QuickStart.java
Run the example to see how to create an invoice and calculate its totals using the InvoiceCalculator.
// Create and calculate an invoiceInvoiceinvoice = newInvoiceCalculator().calculate(TestInvoiceFactory.createMinimalInvoice());
// Create a ZUGFeRD PDFFileinputPdf = newFile("invoice.pdf");
FileoutputPdf = newFile("zugferd-invoice.pdf");
ZugferdPdfWriter.builder()
.invoice(invoice)
.profile(ZugferdProfile.EN16931)
.prettyPrint(true)
.build()
.write(inputPdf, outputPdf);
System.out.println("ZUGFeRD invoice written to: " + outputPdf);
// Read the ZUGFeRD PDF backInvoiceparsedInvoice = ZugferdPdfReader.builder()
.build()
.read(outputPdf);
System.out.println("Invoice number: " + parsedInvoice.getInvoiceNumber());
System.out.println("Seller: " + parsedInvoice.getSeller().getName());
System.out.println("Buyer: " + parsedInvoice.getBuyer().getName());
System.out.println(
"Payable amount: "
+ parsedInvoice.getMonetarySummation()
.getPayableAmount()
.getAmount()
+ " "
+ parsedInvoice.getCurrency()
);
Clone the repository and execute:
mvn testTo run the complete verification including integration tests:
mvn verify| Version | Milestone | Status |
|---|---|---|
| v0.1.0 | Core Model - Invoice calculation engine | Finished |
| v0.2.0 | CII XML | Finished |
| v0.3.0 | ZUGFeRD | Finished |
| v0.4.0 | XRechnung CII | Finished |
| v0.5.0 | XRechnung UBL | In Progress |
| v1.0.0 | Public Release | Planned |
| v1.1.0 | PEPPOL Support | Planned |
| v1.2.0 | Additional European e-Invoice Formats | Planned |
| v1.3.0 | Streaming APIs | Planned |
| v1.4.0 | Digital Signatures (XAdES/PAdES) | Planned |
See the GitHub Milestones for the detailed implementation plan and progress.
Contributions, bug reports, feature requests, and discussions are welcome.
If you would like to contribute, please open an issue.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
If invoice4j is useful to you, consider supporting its development.
Development of invoice4j requires time for implementing new features, improving documentation, maintaining standards compatibility, and providing support.
PayPal:https://paypal.me/juniorscholle
invoice4j is currently in an early development stage.
The project is published at this stage to gather feedback from developers and users working with electronic invoices such as ZUGFeRD and XRechnung.
The goal is to find out whether invoice4j solves real-world problems and whether the architecture, API design, and supported standards meet the needs of the community.
At this stage:
- The API may still change.
- Some features are not implemented yet.
- Documentation is actively being improved.
- Production usage is not recommended until a stable release is available
Feedback is highly appreciated:
- Feature requests
- Missing invoice fields or standards
- API design suggestions
- Real-world use cases
- Bug reports
If you work with electronic invoices and have requirements or suggestions, please open an issue or start a discussion.
Thank you for helping shape invoice4j.