Skip to content
Paniolo

Paniolo API reference — 1.0.0

This reference and its quickstart describe the release 1.0.0. The examples use the same English API names as the JavaDoc and require no application framework.

ItemPinned value
Release version1.0.0
Source commit3a23b2b8f91d10f4a25012fa60afb827b21ef255
Maven artifact version used below1.0.0 (Maven Central)
Documentation revision1, 2026-11-18
Java / Maven used to verify the quickstartTemurin 21.0.12.1 / Apache Maven 3.9.9
XRechnung rulesXRechnung 3.0.2, KoSIT release 2026-08-31
Factur-X / ZUGFeRD rulesFactur-X 1.09.2 / ZUGFeRD 2.5.2
French rulesFNFE-MPE France_RFE 1.4.0.04

1.0.0 is the first stable release, published to Maven Central. The quickstart resolves all Paniolo artifacts from there; it needs no Paniolo source checkout and no local build of the library.

Keep this file as the reference for release 1.0.0. Each release gets its own file docs/api/<version>.md; update the README link with it. Source links below are repository-relative; inspect them in the tag 1.0.0 when comparing against a newer checkout.

Compared with 1.0.0-rc02, the artifacts, packages and existing class names are unchanged. New are quotations (Quotation, QuotationLine, toPdf(Quotation), JSON storage and the CLI command group paniolo quotation), the insurance tax AAM of EXTENDED as OtherTax, the calculation of cash discount amounts, the kind of the payment account (AccountIdType), and the PDF options PdfProfile, fold marks and the accent color as web color. Some records have new components, so code that calls their canonical constructors must add the new arguments: ExtendedInformation and LineExtension (otherTaxes), CreditTransfer (idType) and PdfLayout (profile, foldMarks). Builders, factory methods and stored JSON are unchanged. The rendered PDFs use the packaged font IBM Plex Sans, so line and page breaks can differ from rc02. All changes are listed in the changelog.

Reproducible quickstart

The quickstart creates one invoice, writes and validates it as both UBL and CII, reads it back, and checks its amount due. Dates, amounts, artifact versions and Maven plugin versions are fixed. The output XML is for demonstration; replace the example parties and identifiers before use. This reproduces API behavior and semantic results, not byte-identical Maven archives or report timestamps across machines.

1. Prepare the project directory

Requirements: JDK 21, Maven 3.9.9, and a POSIX shell with mktemp (Linux or macOS). The first Maven build needs network access to download the Paniolo artifacts and their dependencies from Maven Central. Invoice processing after the build needs no network connection.

All shell steps in this quickstart use the same terminal session.

set -eu
java -version
mvn -version

PANIOLO_QUICKSTART_DIR=$(mktemp -d "${TMPDIR:-/tmp}/paniolo-quickstart.XXXXXX")
mkdir -p "$PANIOLO_QUICKSTART_DIR/app/src/main/java/example"
cd "$PANIOLO_QUICKSTART_DIR/app"

Keep the printed temporary directory path if you want to return to the example later; echo "$PANIOLO_QUICKSTART_DIR" shows it.

2. Create the application POM

Save the following as pom.xml in the app directory created above. The application has no parent POM and uses the exact release version 1.0.0 from Maven Central.

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>example</groupId>
  <artifactId>paniolo-quickstart</artifactId>
  <version>1.0.0</version>
  <properties>
    <maven.compiler.release>21</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>io.github.nalukit</groupId>
      <artifactId>paniolo</artifactId>
      <version>1.0.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.3.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.14.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.7.0</version>
      </plugin>
    </plugins>
  </build>
</project>

3. Create the invoice application

Save this complete class as src/main/java/example/Quickstart.java in the same app directory. No imports or helper objects are omitted.

package example;

import io.github.nalukit.paniolo.Paniolo;
import io.github.nalukit.paniolo.config.InvoiceSyntax;
import io.github.nalukit.paniolo.model.Invoice;
import io.github.nalukit.paniolo.model.common.Address;
import io.github.nalukit.paniolo.model.common.Contact;
import io.github.nalukit.paniolo.model.common.CreditTransfer;
import io.github.nalukit.paniolo.model.common.DeliveryInformation;
import io.github.nalukit.paniolo.model.common.ElectronicAddress;
import io.github.nalukit.paniolo.model.common.InvoiceLine;
import io.github.nalukit.paniolo.model.common.Party;
import io.github.nalukit.paniolo.model.common.PaymentInstruction;
import io.github.nalukit.paniolo.model.common.TaxCategory;
import io.github.nalukit.paniolo.model.common.value.Country;
import io.github.nalukit.paniolo.model.common.value.PaymentMeansCode;

import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDate;

public final class Quickstart {
  public static void main(String[] args) throws Exception {
    var seller = Party.create()
                      .name("Muster GmbH")
                      .address(new Address("Musterstraße 1", "Berlin", "10115", Country.DE))
                      .vatId("DE123456788")
                      .electronicAddress(new ElectronicAddress("rechnung@example.org", "EM"))
                      .contact(new Contact("Erika Muster", "+49 30 123456", "rechnung@example.org"))
                      .build();
    var buyer = Party.create()
                     .name("Kunde GmbH")
                     .address(new Address("Kundenweg 2", "Hamburg", "20095", Country.DE))
                     .electronicAddress(new ElectronicAddress("einkauf@example.org", "EM"))
                     .build();
    var payment = PaymentInstruction.create()
                                    .meansCode(PaymentMeansCode.CODE_58)
                                    .addCreditTransfer(CreditTransfer.create()
                                                                     .iban("DE89370400440532013000")
                                                                     .accountName("Muster GmbH")
                                                                     .bic("COBADEFFXXX")
                                                                     .build())
                                    .remittanceInformation("R-2026-001")
                                    .build();
    Invoice invoice = Invoice.create()
                             .number("R-2026-001")
                             .issueDate(LocalDate.of(2026, 10, 27))
                             .dueDate(LocalDate.of(2026, 11, 10))
                             .delivery(DeliveryInformation.create()
                                                          .actualDeliveryDate(LocalDate.of(2026, 10, 26))
                                                          .build())
                             .buyerReference("04011000-12345-03")
                             .seller(seller)
                             .buyer(buyer)
                             .paymentInstruction(payment)
                             .addLine(InvoiceLine.create()
                                                 .id("1")
                                                 .name("Beratung")
                                                 .quantity(new BigDecimal("2"))
                                                 .unitCode("HUR")
                                                 .netUnitPrice(new BigDecimal("100.00"))
                                                 .tax(TaxCategory.standard(new BigDecimal("19")))
                                                 .build())
                             .build();

    Paniolo paniolo = Paniolo.create();
    Path output = Path.of("target", "invoices");
    Files.createDirectories(output);
    for (InvoiceSyntax syntax : InvoiceSyntax.values()) {
      byte[] xml = paniolo.toBytes(invoice, syntax);
      var result = paniolo.validate(xml);
      if (!result.isValid() || result.hasWarnings()) {
        throw new IllegalStateException(result.toXml());
      }
      Invoice received = paniolo.read(xml);
      if (!invoice.number().equals(received.number())
          || received.totals().payableAmount().compareTo(new BigDecimal("238.00")) != 0) {
        throw new IllegalStateException("Unexpected round-trip result for " + syntax);
      }
      Files.write(output.resolve("invoice-" + syntax.name() + ".xml"), xml);
      System.out.println(syntax + ": valid, warnings=false, number=" + received.number()
          + ", payable=" + received.totals().payableAmount().toPlainString() + " EUR");
    }
  }
}

The builder defaults to EUR, document type 380, and the XRechnung process identifiers. Two hours at EUR 100.00 plus 19% VAT result in EUR 238.00. The checks use BigDecimal.compareTo so decimal scale differences do not change the result.

4. Compile and run

Still in the app directory:

mvn -B -ntp compile \
  org.apache.maven.plugins:maven-dependency-plugin:3.7.0:copy-dependencies \
  -DincludeScope=runtime
java -cp 'target/classes:target/dependency/*' example.Quickstart

Expected standard output (JVM diagnostics may additionally appear on standard error):

UBL: valid, warnings=false, number=R-2026-001, payable=238.00 EUR
CII: valid, warnings=false, number=R-2026-001, payable=238.00 EUR

The example writes target/invoices/invoice-UBL.xml and target/invoices/invoice-CII.xml. Any validation error, warning or failed round-trip check terminates the process with an error. Once the application is compiled and the dependencies have been copied, the java command also works without network access. XML output does not require any PDF or JSON modules.

Artifacts and entry points

All Paniolo artifacts use group ID io.github.nalukit. When adding optional modules to this quickstart, use the same version 1.0.0 for each module.

ArtifactEntry points and role
panioloPaniolo, its Builder, InvoiceSyntax, FacturXProfile, FacturXResult, PdfAttachment, PdfLayout, PdfProfile, PdfProducer, AfRelationship, UnknownDocumentHandling, CalculationCheck, PdfaScriptCache; brings the model and the packaged rules
XML: InvoiceXmlReader, InvoiceXmlWriter, ReadMode, ReadResult, ReadWarning, ImportResult, ExportVariant, StatedAmounts, AmountDeviation; UBL, CII, ZUGFeRD 1.0, Order-X and despatch advice readers and writers
Validation: InvoiceValidator, ValidationProfile, XrechnungScenario, XrechnungSpecification, ValidationMessage, ValidationResult, ValidationStatistics, AcceptancePolicy, Severity, ValidationException
paniolo-shared-modelInvoice, common values, invoice totals, EXTENDED data, Order, DespatchAdvice, Quotation; no runtime dependencies
paniolo-rulesXrechnungRules: current and legacy KoSIT bundles; FacturXRules: Factur-X, ZUGFeRD 1.0, French EXTENDED-CTC-FR / BR-FR and Order-X rules
paniolo-facturxPdfBoxFacturXSupport, PdfBoxLayoutSupport: optional PDF support and rendering of the visual PDF/A-3b pages, normally accessed through the facade
paniolo-pdfaVeraPdfaSupport: optional PDF/A conformance checks
paniolo-jsonPanioloJson, PanioloJsonModule: optional model storage with Jackson 3
paniolo-visualizerPanioloVisualizer and the web component <paniolo-viewer>: optional display of documents in the browser and as standalone HTML
paniolo-cliPanioloCli: command line interface, executable jar with the classifier all; published to GitHub Packages, not to Maven Central
paniolo-mustangMustangInvoiceAdapter, MustangMapping, MappingLoss, FieldMapping: optional migration from Mustang IExportableTransaction

Modules can also be used individually. See their README files via the module index. The generated JavaDoc includes all public types; utility types in internal, base, util and common.validation packages are implementation infrastructure rather than the recommended application entry points. FacturXSupport, PdfaSupport and PdfLayoutSupport are service-provider interfaces for alternative implementations, discovered with ServiceLoader; providers must be thread-safe.

Facade reference

The entry point is io.github.nalukit.paniolo.Paniolo. Create one instance and reuse it. Writers and readers do not compile validation rules. Validators are initialized lazily and cached per facade; warmUp() prepares the XRechnung invoice validators.

Construction and detection

SignatureResult / behavior
static Paniolo create()Facade with packaged default rules
static Paniolo.Builder builder()Builder for alternative or additional rule bundles
Paniolo warmUp()Initializes XRechnung validators and returns this facade
static boolean isPdf(byte[] content)Tests the PDF header; does not validate the PDF
ValidationProfile.Syntax detect(String xml)Detects UBL_INVOICE, UBL_CREDIT_NOTE or CII
ValidationProfile.Syntax detect(byte[] xml)Same detection for XML bytes; not a general order/PDF detector
boolean isEInvoice(byte[] xmlOrPdf)Cheap check for an EN 16931 invoice in XML or PDF; never throws for unsuitable content
Optional<ValidationProfile.Syntax> probe(byte[] xmlOrPdf)Same check, returns the document type; empty for no electronic invoice
static void releasePdfaScriptCache()Releases the PDF/A rules veraPDF cached for the calling thread

isEInvoice and probe read only the start of the XML (root element, for CII the specification identifier BT-24) and, for a PDF, the embedded files, without validating. ZUGFeRD 1.0, Order-X, despatch advices and the Factur-X profiles MINIMUM and BASIC WL, which are no electronic invoices in Germany, yield false / an empty result. A PDF needs paniolo-facturx.

Invoice XML and validation

SignatureResult / behavior
String toXml(Invoice invoice, InvoiceSyntax syntax)Writes UBL or CII XML; does not run schema or business-rule validation
byte[] toBytes(Invoice invoice, InvoiceSyntax syntax)Writes UTF-8 XML bytes
Invoice read(String xml)Reads invoice XML strictly, detecting the syntax
Invoice read(byte[] xmlOrPdf)Reads invoice XML or a hybrid invoice PDF strictly
Invoice read(InputStream xmlOrPdf)Reads without closing the caller's stream
ReadResult read(String xml, ReadMode mode)Reads XML with explicit amount handling
ReadResult read(byte[] xmlOrPdf, ReadMode mode)Same for XML or PDF bytes
ReadResult read(InputStream xmlOrPdf, ReadMode mode)Same for a caller-owned stream
ImportResult importInvoice(byte[] xmlOrPdf, ReadMode mode)Reads and keeps the original XML, the stated amounts and every AmountDeviation from the model
byte[] export(ImportResult imported, ExportVariant variant, InvoiceSyntax syntax)ORIGINAL returns the received XML unchanged; NORMALIZED writes the model in the given syntax (refused after READ-OTHER-TAX); NORMALIZED_DROPPING_OTHER_TAXES does so without the taxes other than VAT
ValidationResult validate(String xml)Detects the invoice syntax/profile and validates XML
ValidationResult validate(byte[] xmlOrPdf)Validates invoice XML or a hybrid invoice PDF
ValidationResult validate(InputStream xmlOrPdf)Same for a caller-owned stream
ValidationResult validate(Invoice invoice, InvoiceSyntax syntax)Writes and validates the invoice in the selected syntax
ValidationResult validate(byte[] xml, ValidationProfile.Syntax type)Uses the explicit XRechnung document type; malformed XML becomes a finding rather than failing detection
ValidationResult validate(byte[] xml, FacturXProfile profile)Validates XML against the explicitly selected Factur-X profile

read accepts UBL Invoice/CreditNote, CII, ZUGFeRD 1.0 XML and supported invoice PDFs. It does not replace validation. ReadMode.STRICT rejects inconsistent amounts; LENIENT can adapt supported amount deviations and returns them in ReadResult.warnings(). Preserve original input bytes when you need an unchanged source document, or use importInvoice, which keeps them in the ImportResult. ReadResult.isExact() means no accepted amount deviations were reported; it does not promise byte-identical XML or complete support for arbitrary extensions.

Automatic validation selects rules from the specification identifier (BT-24) and PDF metadata. The overload with ValidationProfile.Syntax deliberately bypasses profile detection and always uses the EN 16931/XRechnung rules for that syntax. Use the automatic overload for Factur-X profiles and the XRechnung extension. By default, the detecting overloads throw an IllegalArgumentException for a document whose type they cannot detect; Builder.unknownDocuments(UnknownDocumentHandling.REPORT_INVALID) returns an invalid result with the FATAL finding XML-PARSE or PANIOLO-UNKNOWN-DOCUMENT instead.

PDF invoices

PDF operations require paniolo-facturx, which also renders the visual PDF/A-3b pages for the overloads without a PDF of your own, toPdf and toReportPdf. ZUGFeRD 1.0 XML migration works with the base artifact; the same migration methods need the PDF module only when their input is a PDF.

SignatureResult / behavior
byte[] toFacturX(Invoice invoice, byte[] pdfA, FacturXProfile profile)Embeds CII in a supplied visual PDF/A document
byte[] toFacturX(Invoice invoice, byte[] pdfA, FacturXProfile profile, List<PdfAttachment> attachments)Same with additional attachments
byte[] toFacturX(Invoice invoice, FacturXProfile profile)Renders the invoice page and embeds the CII (rendered)
byte[] toFacturX(Invoice invoice, FacturXProfile profile, PdfLayout layout, List<PdfAttachment> attachments)Same with language, logo, fonts, accent color, footer and attachments
FacturXResult embedXml(byte[] pdfA, byte[] xml, FacturXProfile profile) and overload with attachmentsEmbeds existing CII byte for byte and returns the PDF with its validation result
byte[] toPdf(Invoice invoice) and overload with PdfLayoutRenders only the visual document, without XML; PDF/A-3b unless the layout selects another PdfProfile (rendered)
byte[] toReportPdf(ValidationResult result, String fileName, byte[] document) and overload with PdfLayoutRenders a validation report as PDF/A-3b (rendered)
byte[] extractXml(byte[] pdf)Returns the embedded invoice XML
byte[] extractOrderXml(byte[] pdf)Returns the embedded Order-X XML unchanged
byte[] extractDespatchAdviceXml(byte[] pdf)Returns the embedded despatch advice XML (CIDA) unchanged
List<PdfAttachment> attachments(byte[] pdf)Returns attachments other than the invoice XML
PdfProducer producer(byte[] pdf)Returns producer/creator metadata and recognized invoice software
byte[] migrateZugferd1(byte[] document)Migrates ZUGFeRD 1.0 XML or PDF to version 2
byte[] migrateZugferd1(byte[] document, FacturXProfile target)Migrates with an explicit target profile

A supplied PDF must already be PDF/A and contain the visual document; Paniolo does not convert arbitrary PDFs into compliant PDF/A. Without a PDF of your own, the rendering overloads create the pages with paniolo-facturx (DIN 5008, German, English and French, logo, own fonts); PdfLayout.of(locale) and its with... methods configure them. The default font is the packaged IBM Plex Sans. withProfile(PdfProfile) selects the kind of PDF that toPdf renders: PDF_A_3B (default), PDF_A_1B as visual part for toFacturX(invoice, pdfA, profile), and PREVIEW or PREVIEW_2_0 without PDF/A; the methods that embed XML reject the preview profiles. withFoldMarks(false) hides the DIN 5008 fold and hole marks, and withAccentColor(String) takes a web color such as "#01244F". Factur-X profiles are MINIMUM, BASIC_WL, BASIC, EN16931, EXTENDED and XRECHNUNG. EXTENDED_CTC_FR is supported as CII XML, not as a newly generated Factur-X PDF. MINIMUM and BASIC WL use invoices without lines and with DocumentTotals supplied through Invoice.Builder.statedTotals(...). embedXml rejects input it cannot embed (no PDF/A, encrypted, already an invoice, not CII, BT-24 of another profile) with an IllegalArgumentException; rule violations of the XML are reported in FacturXResult.validation().

Orders and despatch advices

SignaturesResult / behavior
String toOrderX(Order order), byte[] toOrderXBytes(Order order)Order-X XML
byte[] toOrderXPdf(Order order, byte[] pdfA) and overload with List<PdfAttachment>Order-X PDF; requires PDF module
byte[] toOrderXPdf(Order order) and overload with PdfLayout, List<PdfAttachment>Order-X PDF with rendered pages (rendered)
byte[] toPdf(Order order) and overload with PdfLayoutVisual PDF/A-3b order only, without XML (rendered)
Order readOrder(String xml)Strict Order-X XML import
Order readOrder(byte[] xmlOrPdf) and overload with boolean ignoreUnsupportedImport XML/PDF; true explicitly drops unsupported content
ValidationResult validateOrder(byte[] xmlOrPdf)Order-X checks with the packaged official Order-X 1.0 rules
String toDespatchAdvice(DespatchAdvice advice), byte[] toDespatchAdviceBytes(DespatchAdvice advice)UBL DespatchAdvice XML
String toCiiDespatchAdvice(DespatchAdvice advice), byte[] toCiiDespatchAdviceBytes(DespatchAdvice advice)CIDA XML
byte[] toDespatchAdvicePdf(DespatchAdvice advice, byte[] pdfA) and overload with List<PdfAttachment>CIDA PDF; requires PDF module
byte[] toDespatchAdvicePdf(DespatchAdvice advice) and overload with PdfLayout, List<PdfAttachment>CIDA PDF with a rendered delivery note (rendered)
byte[] toPdf(DespatchAdvice advice) and overload with PdfLayoutVisual PDF/A-3b delivery note only (rendered)
DespatchAdvice readDespatchAdvice(byte[] xmlOrPdf) and overload with boolean ignoreUnsupportedUBL/CIDA XML or CIDA PDF import
ValidationResult validateDespatchAdvice(byte[] xmlOrPdf)UBL schema and configured Peppol rules, or limited CIDA checks

Order-X BASIC and COMFORT are supported; EXTENDED has the supported COMFORT content. Some COMFORT and despatch-advice fields are outside the model. CIDA has no packaged official schema or business rules. See the scope and limitations before selecting these formats.

Quotations

SignatureResult / behavior
byte[] toPdf(Quotation quotation) and overload with PdfLayoutVisual PDF/A-3b quotation ("Angebot") without XML; requires PDF module (rendered)

A quotation is no electronic invoice and has no XML syntax. The PDF shows the validity, the lines of the standard offer with their totals, the optional lines apart from the totals, and delivery and payment terms; it shows no payment instruction and no amount due. To invoice an accepted offer, use Quotation.toInvoice(number, issueDate) for the standard offer or toInvoice(number, issueDate, acceptedOptionalLineIds) with the accepted optional lines; toInvoiceBuilder(...) returns the invoice builder to add payment instruction or due date first. The CLI offers the same with paniolo quotation to-pdf and paniolo quotation to-invoice.

Model reference

Model packages start with io.github.nalukit.paniolo.model. Records are immutable; mutable builders are for one operation/thread. Prefer Type.create()...build() for named construction. Constructors and builders enforce structural checks; validation against the official XML rules is separate. JavaDoc documents record components with BT/BG references where applicable.

AreaMain types and use
InvoiceInvoice, InvoiceLine, InvoiceTotals, DocumentTotals, VatBreakdown; invoice.totals() derives monetary values
Parties and addressesParty, Address, Contact, ElectronicAddress, Payee, SellerTaxRepresentativeParty
Process and referencesProcessControl, References, PrecedingInvoiceReference, InvoiceNote, InvoicePeriod, DeliveryInformation
PaymentPaymentInstruction, CreditTransfer, AccountIdType, DirectDebit, PaymentCardInformation, CashDiscount
Allowances, charges and attachmentsDocumentAdjustment, LineAdjustment, AdditionalSupportingDocument, Attachment, ThirdPartyPayment
Items and VATItemAttribute, ItemClassification, TaxCategory; amounts and percentages use BigDecimal
Code lists (common.value)Country, CurrencyCode, UnitCode, InvoiceTypeCode, PaymentMeansCode, DutyTaxFeeCategory, DateTimeQualifier, TextSubjectQualifier, AllowanceChargeIdentification
LocalizationLocalizationFactory; explicit Locale, English fallback; no global language switch
EXTENDED (extended)ExtendedInformation, LineExtension, PartyExtension, ExtendedContact, AdjustmentExtension, AdvancePayment, FinancialAdjustment, LogisticsServiceCharge, PaymentTerm, PaymentTermsAdjustment, TaxExchangeRate
EXTENDED item/reference detailsDocumentReference, TypedDocumentReference, IncludedProduct, ProductCharacteristic, ProductInstance, LineSubtype
Orders (order)Order, OrderLine, OrderTotals, OrderTypeCode, OrderXProfile, SubstitutedProduct
Delivery notes (despatch)DespatchAdvice, DespatchLine, DespatchItemInstance
Quotations (quotation)Quotation, QuotationLine (standard or optional); totals() counts optional lines only if accepted

CreditTransfer states the kind of the account identifier (BT-84): Builder.iban(...) for an IBAN, Builder.proprietaryId(...) or CreditTransfer.proprietary(id, name, bic) for another account number. UBL carries no kind, so accounts read from UBL are IBAN accounts. In EXTENDED, ExtendedInformation.otherTaxes() holds document-level taxes other than VAT; only the insurance tax AAM is supported, and OtherTax.insuranceTax(category, rate, basis) calculates its amount. PaymentTermsAdjustment.withComputedAmount() and PaymentTerm.withComputedDiscount(base) calculate a missing cash discount or penalty amount, rounded half up to cents.

Use decimal strings such as new BigDecimal("19") instead of binary floating-point constructors. Use LocalDate for document dates. Code-list factories such as UnitCode.of("HUR") return null for unknown values; check the result before passing it to a required model field.

Validation and error handling

API / outcomeMeaning
ValidationResult.isValid()No findings of severity ERROR or FATAL
ValidationResult.hasWarnings()At least one WARNING; inspect INFO findings for skipped checks too
ValidationResult.messages()All findings; each has rule ID, severity, message, location and stage
ValidationResult.messages(stage)Findings of a single stage
ValidationResult.count(severity)Number of findings with that severity
ValidationResult.toXml()Machine-readable report; schema at ValidationResult.REPORT_SCHEMA
ValidationResult.statistics()Fired rules per Schematron stylesheet and PDF/A checks with ruleStatistics(true); otherwise null
ValidationMessage.StageXML, XSD, SCHEMATRON, PDF_A, HYBRID, CALCULATION
AcceptancePolicy.evaluate(result)AcceptanceDecision with valid(), accepted() and the blocking findings of explicitly named rules
NullPointerExceptionA required API argument is null
IllegalArgumentExceptionUnprocessable input, unsupported content or failed model constraints; auto-detection may reject malformed XML
IllegalStateExceptionA PDF operation needs an optional module that is not on the classpath
ValidationExceptionBroken validation configuration or execution failure; distinct from an invalid invoice
UncheckedIOExceptionAn underlying input/output operation failed

A valid result is not proof that every possible stage ran. Without paniolo-pdfa, PDF validation includes PDFA-NOT-CHECKED; without configured Peppol rules it includes PEPPOL-RULES-NOT-CHECKED. CIDA reports CIDA-NOT-CHECKED. Decide which stages and findings your application requires. XSD failure skips Schematron execution. Rule bundles are trusted application resources; local imports and declared lookup documents are restricted to configured resources, and rules are not downloaded during validation.

With calculationCheck(true), invoice validations also recalculate the amounts and report differences in the stage CALCULATION with rule IDs starting with PANIOLO-CALC-. These findings are warnings or information and never change isValid(). Which warnings a receiving process must not accept is decided separately with AcceptancePolicy.officialRules().rejectOn(ruleIds...) or rejectOnWarnings(); the official result stays unchanged.

For direct validation without the facade, create an InvoiceValidator from a ValidationProfile and reuse it. ValidationProfile describes local XSDs, compiled Schematron XSLTs, severity overrides and permitted lookup documents. Raw .sch sources are not compiled by this API. ValidationProfile.xrechnung(bundle, syntax, XrechnungScenario) selects the standard, extension or CVD scenario of a KoSIT bundle, and ValidationProfile.xrechnungSpecifications(bundle) lists the specification identifiers (BT-24) its scenarios accept. A document that states an XRechnung identifier no packaged or configured release accepts is invalid with XR-SPECIFICATION-UNSUPPORTED. See validating XML for factories and report structure.

Configuration and optional modules

Paniolo.builder() exposes the following configuration methods; each returns the same builder:

Builder methodPurpose
rules(Path bundle)Alternative extracted KoSIT XRechnung bundle
facturXRules(Path packageDirectory)Alternative extracted Factur-X / ZUGFeRD rule package
extendedCtcFrRules(Path directory)Alternative French EXTENDED-CTC-FR / BR-FR rules
orderXRules(Path packageDirectory)Official Order-X package supplied by the application
despatchAdviceRules(Path compiledSchematron)Compiled Peppol Despatch Advice stylesheet supplied by the application
calculationCheck(boolean enabled)Additional recalculation of invoice amounts (stage CALCULATION)
ruleStatistics(boolean enabled)Rule statistics in ValidationResult.statistics(); slower, for audits
unknownDocuments(UnknownDocumentHandling handling)THROW (default) or REPORT_INVALID for undetectable documents
pdfaScriptCache(PdfaScriptCache cache)REUSE (default) or CLEAR_AFTER_CHECK for the PDF/A rules veraPDF caches per thread
build()Creates an immutable facade with the configured paths

The XRechnung, Factur-X, French and Order-X defaults are packaged dependencies. The Peppol Despatch Advice rules have no published license and must be obtained separately and configured. Rule paths must remain available while the facade is in use. Builders themselves are not thread-safe.

To add PDF, rendering or JSON support to the example POM, add the corresponding artifact with group ID io.github.nalukit and version 1.0.0. No explicit registration is needed for the PDF providers. paniolo-facturx reads, writes and renders PDFs; add paniolo-pdfa as well to include PDF/A checking (see compiled rules per thread).

PanioloVisualizer.create().toHtml(document) writes a standalone HTML page that shows an invoice, order or despatch advice with the web component <paniolo-viewer>; web applications load the component from /paniolo-visualizer/paniolo-visualizer.js in the artifact. See the visualizer module. MustangInvoiceAdapter.create().map(transaction) maps a Mustang invoice to the model and lists every value it cannot carry over; see the Mustang module.

PanioloJson.create() is the JSON entry point. toJson, toPrettyJson and toBytes serialize the model; read(input, Invoice.class) also accepts Order.class, DespatchAdvice.class and Quotation.class. The JSON is Paniolo's storage format and follows this model version, not a standardized invoice exchange format. Loading performs model checks. PanioloJson.configure and PanioloJsonModule use Jackson 3 (tools.jackson.databind); JSON stored with 1.0.0-rc01 loads unchanged. See the JSON module and Jackson version.

Complete generated JavaDoc

Generate the full API reference from the release sources (tag 1.0.0):

git clone --depth 1 --branch 1.0.0 https://github.com/NaluKit/paniolo.git \
  "$PANIOLO_QUICKSTART_DIR/source"
mvn -B -ntp -f "$PANIOLO_QUICKSTART_DIR/source/pom.xml" \
  org.apache.maven.plugins:maven-javadoc-plugin:3.12.0:aggregate \
  -Dshow=public -Ddoclint=all,-missing -DfailOnError=true

Open $PANIOLO_QUICKSTART_DIR/source/target/reports/apidocs/index.html. This generated reference contains the public types, constructors, exact overloads, record parameters and method JavaDoc of the release. It includes the application APIs, provider interfaces and public helpers. The optional benchmark module is not part of the default build; add -Pbenchmark to include it.

The command checks JavaDoc syntax, links and markup; -missing suppresses completeness warnings for individual members and enum constants. It does not claim every public member is documented. The Markdown reference remains available without generating HTML.

Troubleshooting

SymptomResolution
git clone cannot find 1.0.0Use the tag 1.0.0; it is created when the release is published. A branch name or newer snapshot is not an equivalent baseline.
Maven cannot resolve 1.0.0Check network access to Maven Central and that your Maven settings (mirrors, proxies, repository managers) allow release artifacts from Central.
Java reports an unsupported class version or compiler releaseRun both Maven and java with JDK 21; check mvn -version as well as java -version.
First build cannot download rules/dependenciesEnable network access for the build. Runtime processing uses the packaged rule bundles. Do not skip checksum failures.
IllegalStateException names a PDF moduleAdd paniolo-facturx at the same version; add paniolo-pdfa for conformance checks.
Invalid result or warnings in the quickstartInspect the XML report in the exception. Confirm the exact version and unchanged sample values; the sample checks both syntaxes.
App cannot find example.QuickstartRun the compile/copy step and the java command from the app directory. The classpath shown is for Linux/macOS.