VeritasData.Net.FacturX.Pdf
1.0.0-rc.7
dotnet add package VeritasData.Net.FacturX.Pdf --version 1.0.0-rc.7
NuGet\Install-Package VeritasData.Net.FacturX.Pdf -Version 1.0.0-rc.7
<PackageReference Include="VeritasData.Net.FacturX.Pdf" Version="1.0.0-rc.7" />
<PackageVersion Include="VeritasData.Net.FacturX.Pdf" Version="1.0.0-rc.7" />
<PackageReference Include="VeritasData.Net.FacturX.Pdf" />
paket add VeritasData.Net.FacturX.Pdf --version 1.0.0-rc.7
#r "nuget: VeritasData.Net.FacturX.Pdf, 1.0.0-rc.7"
#:package VeritasData.Net.FacturX.Pdf@1.0.0-rc.7
#addin nuget:?package=VeritasData.Net.FacturX.Pdf&version=1.0.0-rc.7&prerelease
#tool nuget:?package=VeritasData.Net.FacturX.Pdf&version=1.0.0-rc.7&prerelease
VeritasData.Net.FacturX
The independent VeritasData.Net.FacturX.Pdf library prepares supported PDFs for PDF/A-3b and embeds
an EN 16931 CII invoice without changing its XML bytes. VeritasData.Net.FacturX.Xml generates the invoice XML.
Runnable XML creation and PDF embedding examples, including file and byte-array conversion, are documented in examples/README.md.
XML Generation
The separate VeritasData.Net.FacturX.Xml package generates
EN 16931 CII XML using typed models generated from the official Factur-X 1.09.2 / ZUGFeRD 2.5.2 schemas.
It provides strict serialization, decimal calculation helpers, and dependency injection registration.
The optional VeritasData.Net.FacturX.Xml.Validation package adds offline XSD and Schematron validation
with embedded standard resources and SaxonCS-HE. Validation depends on XML; XML does not depend on validation.
The PDF library remains independent of both XML projects.
using VeritasData.Net.FacturX.Xml.DependencyInjection;
builder.Services.AddFacturXXml();
For validation-enabled applications, reference the validation package and use AddFacturXValidation() instead.
Use IFacturXSerializer to read and write typed invoices; validation is explicit and never recalculates totals.
The creation example builds a complete invoice,
validates it, and writes XML that can be supplied to the PDF converter. Authored XML code retains its supplied
license; standard artifacts and dependencies retain their own licenses, recorded in the
third-party notices.
ASP.NET Core Integration
Reference the library project and register the converter in the application's service collection:
using VeritasData.Net.FacturX.Pdf;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IFacturXPdfConverter, FacturXPdfConverter>();
Inject IFacturXPdfConverter into the consuming service or controller and call:
await converter.ConvertAsync(inputPdfPath, invoiceXmlPath, outputPdfPath);
To return a PDF from an ASP.NET Core controller action without creating an output file:
byte[] pdf = await converter.ConvertToBytesAsync(inputPdfPath, invoiceXmlPath);
return File(pdf, "application/pdf", "invoice.pdf");
ConvertToBytesAsync reads the same source files and returns a complete PDF with the original XML attachment.
It does not create an output file or modify either source. The returned array belongs to the caller.
The implementation is stateless and keeps document, stream, and metadata state local to each conversion.
Singleton registration avoids creating a service instance for each request; it does not cache generated PDFs.
The library does not depend on ASP.NET Core or a dependency injection container.
Applications without dependency injection can instantiate FacturXPdfConverter directly.
Naming Migration
The packages and namespaces are now VeritasData.Net.FacturX.Pdf and VeritasData.Net.FacturX.Xml.
Their former names used FactureX; the PDF library was also previously published without the .Pdf suffix.
After the renamed packages are published, update package references, namespace imports, and API type names:
FacturXPdfConverter and IFacturXPdfConverter for PDF conversion.
The replacement XML implementation removes InvoiceDescriptor, FacturXInvoiceWriter, and
IFacturXInvoiceWriter; migrate XML consumers to the typed model and IFacturXSerializer API.
The solution is now VeritasData.Net.FacturX.slnx. This is a breaking naming change; no compatibility wrapper is provided.
Previously published NuGet packages are not renamed or overwritten. The Azure DevOps project and Git
repository are now FacturX; repository URLs use /FacturX/_git/FacturX. The FactureX NuGet
service connection retains its separate name until explicitly renamed in Azure DevOps.
Framework Support
The PDF and XML core packages target both netstandard2.0 and net10.0.
The optional XML validation package requires net10.0 because SaxonCS-HE 13.1.0 supports only .NET 10.
Both examples use validation and therefore remain .NET 10 applications. Building the repository requires a .NET 10 SDK.
Operational Requirements
- Supply XML that matches the visible invoice. Conversion does not generate invoice data from the PDF.
- Use distinct output paths for concurrent conversions and do not modify their source files while they run.
- Create the destination directory beforehand. Existing output is preserved unless
overwrite: trueis supplied; neither source may be overwritten. - Use server-controlled paths and authorize access to invoice files rather than accepting arbitrary client-supplied paths.
- Allow for the original XML and generated PDF being buffered in memory. A failed final write can leave a partial destination; replacement is not atomic.
- Returning bytes creates an additional copy of the generated PDF buffer; account for this when handling large documents or concurrent requests.
- Keep the bundled ICC profile and its redistribution license with the library sources.
- Validate PDF/A and invoice conformance separately. Unsupported PDF features are rejected rather than repaired.
Tests
Run the test suite from the repository root:
dotnet test VeritasData.Net.FacturX.slnx
To run the same tests against the .NET Standard PDF and XML core assemblies:
dotnet test VeritasData.Net.FacturX.slnx --configuration Release -p:UseNetStandardLibraries=true
This mode rebuilds the tests and verifies the loaded library target frameworks. Do not use --no-build
when switching modes. The test host and validation engine still run on .NET 10; this is not a .NET Framework runtime test.
The XML suite checks serialization, calculations, DI registration, embedded artifact hashes, and offline XSD and Schematron validation. Run the complete creation and validation example with:
dotnet run --project examples/VeritasData.Net.FacturX.Xml.Example --configuration Release
Normal validation needs no Java, network access, or deployed schema files after NuGet restore. It does not replace national CIUS, production-invoice, or PDF/A validation. Model regeneration and standard import tools are documented in the XML package README and are not run during normal builds.
Acceptance Invoices
The acceptance tests run automatically with the XML suite. To run only those tests:
dotnet test tests/VeritasData.Net.FacturX.Xml.Tests/VeritasData.Net.FacturX.Xml.Tests.csproj --configuration Release --filter FullyQualifiedName~FacturXAcceptanceTests
invoice-001 supplies a Factur-X PDF. Its embedded XML must pass strict reading, XSD, and
Schematron validation. The test copies its pages into a temporary plain PDF because the converter
rejects existing attachments, then embeds the original XML and checks byte-for-byte integrity,
page count, and PDF/A identification metadata. The supplied files remain unchanged.
invoice-002 is a negative fixture: its printed totals must report exactly BR-CO-13 and BR-CO-15.
Adding another folder does not automatically add a test; define its expected outcome explicitly.
The generated positive PDF is retained under the ignored test output directory for inspection. Metadata assertions do not prove PDF/A conformance. Install veraPDF separately and run:
verapdf --format xml --flavour 3b tests/VeritasData.Net.FacturX.Xml.Tests/bin/Release/net10.0/AcceptanceResults/invoice-001.pdf
The independent PDF/A check is separate from dotnet test; review its compliance result before
accepting the generated PDF for production. These tests do not compare rendered business values
with the XML or replace acceptance by the intended recipient.
| 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 was computed. 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 is compatible. 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
- PDFsharp-extended (>= 1.3.0)
- System.Security.Cryptography.Pkcs (>= 8.0.2)
-
net10.0
- PDFsharp-extended (>= 1.3.0)
- System.Security.Cryptography.Pkcs (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|