FactoorSharp.FacturX.PDF
21.0.0
dotnet add package FactoorSharp.FacturX.PDF --version 21.0.0
NuGet\Install-Package FactoorSharp.FacturX.PDF -Version 21.0.0
<PackageReference Include="FactoorSharp.FacturX.PDF" Version="21.0.0" />
<PackageVersion Include="FactoorSharp.FacturX.PDF" Version="21.0.0" />
<PackageReference Include="FactoorSharp.FacturX.PDF" />
paket add FactoorSharp.FacturX.PDF --version 21.0.0
#r "nuget: FactoorSharp.FacturX.PDF, 21.0.0"
#:package FactoorSharp.FacturX.PDF@21.0.0
#addin nuget:?package=FactoorSharp.FacturX.PDF&version=21.0.0
#tool nuget:?package=FactoorSharp.FacturX.PDF&version=21.0.0
FactoorSharp.FacturX.PDF
FactoorSharp.FacturX.PDF adds PDF/A-3 support to FactoorSharp.FacturX. It embeds the structured invoice XML (Factur-X / ZUGFeRD / XRechnung) into an existing PDF and reads the XML back out of such hybrid documents.
It is designed for applications that need hybrid electronic invoices, i.e. a human readable PDF that carries the machine readable invoice data as an attachment.
You can find all available license options here: https://www.factoorsharp.com
Overview
A hybrid e-invoice consists of two parts: the visual PDF and the invoice XML (CII or UBL) attached to it. FactoorSharp.FacturX creates and parses the XML; this package takes care of the PDF side:
- it takes your own PDF (an invoice you already print, or one rendered with FactoorSharp.FacturX.Visualization) as source,
- converts it to PDF/A-3,
- embeds the invoice XML with the required metadata, and
- optionally signs the result.
The reverse direction is covered as well: LoadFromPdf extracts the embedded XML from a
Factur-X / ZUGFeRD PDF and returns it as a FacturXInvoice.
Features
- Embed the invoice XML of a
FacturXInvoiceinto a PDF — to a file path or aStream, synchronous orasync - Load a
FacturXInvoicestraight from a Factur-X / ZUGFeRD PDF (path orStream) - Generated files declare PDF/A-3B and carry the matching XMP metadata for ZUGFeRD / Factur-X versions 1.0, 2.0, 2.3, 2.4 and 2.5
- Source PDFs are sanitized for PDF/A: annotation flags, missing fonts (embedded from the
installed system fonts) and
/Encodingof symbolic TrueType fonts are repaired PdfSaveResultreports what was repaired and what could not be repaired (PdfSourceIssue, including the PDF/A rule number as used by veraPDF)- Additional attachments (
PdfAttachment) with a declared/AFRelationship - Optional digital signature from a PFX / PKCS#12 certificate
- Optional password for protected source PDFs
InvoiceFormatOptionsapply to the XML that is embedded- Targets
netstandard2.0,netstandard2.1,net462,net472,net480,net8.0andnet10.0
Installation
Install the package via NuGet:
dotnet add package FactoorSharp.FacturX.PDF
This automatically pulls in FactoorSharp.FacturX as a dependency.
Register under https://www.factoorsharp.com and download the trial license for
FactoorSharp.FacturX (required to create or load a FacturXInvoice).
Package version and core version belong together: use the same major version of
FactoorSharp.FacturX.PDF and FactoorSharp.FacturX.
Usage
Embed an invoice into a PDF
using FactoorSharp.FacturX;
using FactoorSharp.FacturX.PDF;
// FactoorSharp.FacturX requires a valid license to create or load invoices.
FacturXInvoice.SetLicense("...");
FacturXInvoice invoice = FacturXInvoice.Load("invoice.xml");
// "invoice-source.pdf" is the visual representation, "invoice-hybrid.pdf" is created.
PdfSaveResult result = FacturXInvoicePdfProcessor.SaveToPdf(
"invoice-hybrid.pdf",
ZUGFeRDVersion.Version24,
Profile.Comfort,
ZUGFeRDFormats.CII,
"invoice-source.pdf",
invoice);
foreach (PdfSourceIssue issue in result.Issues.Where(i => !i.Resolved))
{
Console.WriteLine(issue);
}
Streams and async overloads (SaveToPdfAsync) are available as well.
Load an invoice from a PDF
FacturXInvoice invoice = FacturXInvoicePdfProcessor.LoadFromPdf("invoice-hybrid.pdf");
Check the result
SaveToPdf returns a PdfSaveResult. It lists every finding in the source PDF, repaired or
not, and exposes HasUnresolvedIssues for a quick check:
if (result.HasUnresolvedIssues)
{
// e.g. a font that is not embedded and not installed on this machine
}
The check only covers the rules the library knows about. An empty list does not replace a validation with a PDF/A validator such as veraPDF.
Additional attachments and signature
var attachments = new[]
{
new PdfAttachment("timesheet.csv", File.ReadAllBytes("timesheet.csv"),
PdfAttachmentRelationship.Supplement, "Timesheet")
};
var signature = new FacturXPdfSignatureSettings
{
Signature = File.ReadAllBytes("certificate.pfx"),
Password = "...",
Reason = "Invoice",
Location = "Hamburg"
};
using var target = File.Create("invoice-signed.pdf");
using var source = File.OpenRead("invoice-source.pdf");
await FacturXInvoicePdfProcessor.SaveToPdfAsync(
target, ZUGFeRDVersion.Version24, Profile.Comfort, ZUGFeRDFormats.CII,
source, invoice, password: null, settings: signature,
additionalAttachments: attachments);
Upgrading from earlier versions
Starting with 20.0.0, SaveToPdf() / SaveToPdfAsync() return PdfSaveResult instead of
void / Task, and generated files declare PDF/A-3B instead of PDF/A-3A. The change in the
signature is binary breaking — recompile callers.
Licensing Model
FactoorSharp.FacturX.PDF is part of the FactoorSharp product family and is licensed under the same commercial terms as FactoorSharp.FacturX:
- The license is granted to a company, not to individual users
- Usage is based on the number of developers working with the library
- Different license tiers are available (e.g. Freelancer, SME, Corporate)
- Customers are expected to select a license that reflects their actual usage
The model follows a fair-use approach and does not enforce strict technical limits.
Subscription and Perpetual Use
FactoorSharp.FacturX.PDF is provided under a subscription model. During an active subscription, customers receive:
- Access to updates and new versions
- Support services
After the subscription ends:
- The last available version remains usable indefinitely
- No further updates or support are included
Redistribution
FactoorSharp.FacturX.PDF can be used within customer applications, including SaaS solutions. Redistribution is permitted under the condition that an appropriate license (including redistribution rights) has been obtained. The software itself and license keys must not be shared with third parties.
Data Protection and Privacy
FactoorSharp.FacturX.PDF processes invoice data only for technical purposes, i.e. to embed it into or read it from a PDF. The documents may contain personal information (e.g. names, addresses). The following principles apply:
- Data is processed only temporarily during the call
- No storage of document content takes place
- No use for analytics, training, profiling, or any other purposes occurs
All data remains under the control of the customer.
Disclaimer
FactoorSharp.FacturX.PDF is a technical tool for creating and reading hybrid invoice documents. No guarantee is given for:
- PDF/A conformance of every possible source PDF
- Legal compliance of the generated documents
- Correctness in all business or regulatory contexts
Users are responsible for ensuring compliance with applicable laws and regulations, and for validating generated documents with a PDF/A validator and an e-invoice validator where required.
License
This software is licensed, not sold. For full terms and conditions, including detailed legal and data protection provisions, please refer to:
https://www.factoorsharp.de/de/Home/Agb
Support
Support is available during an active subscription period.
About
FactoorSharp.FacturX.PDF is developed and maintained by: STwo Industries GmbH Eichenkoppel 19 22399 Hamburg Germany
| 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 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 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. 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. |
-
.NETFramework 4.6.2
- FactoorSharp.FacturX (>= 21.0.0)
- PDFsharp-extended (>= 1.4.0)
- System.Security.Cryptography.Pkcs (>= 10.0.14)
- System.Text.Encoding.CodePages (>= 10.0.14)
-
.NETFramework 4.7.2
- FactoorSharp.FacturX (>= 21.0.0)
- PDFsharp-extended (>= 1.4.0)
- System.Security.Cryptography.Pkcs (>= 10.0.14)
- System.Text.Encoding.CodePages (>= 10.0.14)
-
.NETFramework 4.8
- FactoorSharp.FacturX (>= 21.0.0)
- PDFsharp-extended (>= 1.4.0)
- System.Security.Cryptography.Pkcs (>= 10.0.14)
- System.Text.Encoding.CodePages (>= 10.0.14)
-
.NETStandard 2.0
- FactoorSharp.FacturX (>= 21.0.0)
- PDFsharp-extended (>= 1.4.0)
- System.Security.Cryptography.Pkcs (>= 10.0.14)
- System.Text.Encoding.CodePages (>= 10.0.14)
-
.NETStandard 2.1
- FactoorSharp.FacturX (>= 21.0.0)
- PDFsharp-extended (>= 1.4.0)
- System.Security.Cryptography.Pkcs (>= 10.0.14)
- System.Text.Encoding.CodePages (>= 10.0.14)
-
net10.0
- FactoorSharp.FacturX (>= 21.0.0)
- PDFsharp-extended (>= 1.4.0)
- System.Security.Cryptography.Pkcs (>= 10.0.14)
-
net8.0
- FactoorSharp.FacturX (>= 21.0.0)
- PDFsharp-extended (>= 1.4.0)
- System.Security.Cryptography.Pkcs (>= 10.0.14)
- System.Text.Encoding.CodePages (>= 10.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
21.0.0
* Stream overloads for every PdfUtils method (CountPages, ExtractText*, ExtractAttachments, CanMerge, CanExtract, Merge, ExtractPage(s), AddAttachment)
* Writing path overloads no longer leave a truncated output file behind on error
* Fixed XMP extension schema namespace for ZUGFeRD 2.0: PDFs saved with Version20 pass PDF/A validation again
* NuGet README added
* Updated dependency to core library 21.0.0