Skip to content

Class FacturXDocument

A Factur-X document.

Assembly: FacturXDotNet.dll
csharp
public class FacturXDocument

Properties

Data

The raw document.

csharp
public ReadOnlyMemory<byte> Data { get; }

Methods

GetXmpMetadataStreamAsync(string?, CancellationToken)

Get the XMP metadata of the Factur-X document as a stream.

csharp
public Task<Stream> GetXmpMetadataStreamAsync(string? password = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<System.IO.Stream>: The XMP metadata of the Factur-X document as a stream.

Parameters
TypeNameDescription
System.StringpasswordThe password to open the PDF document.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetXmpMetadataAsync(string?, XmpMetadataReaderOptions?, CancellationToken)

Get the XMP metadata of the Factur-X document as a structured object.

csharp
public Task<XmpMetadata?> GetXmpMetadataAsync(string? password = null, XmpMetadataReaderOptions? xmpParserOptions = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<FacturXDotNet.Models.XMP.XmpMetadata>: The XMP metadata of the Factur-X document.

Parameters
TypeNameDescription
System.StringpasswordThe password to open the PDF document.
FacturXDotNet.Parsing.XMP.XmpMetadataReaderOptionsxmpParserOptionsThe options to parse the XMP metadata.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetCrossIndustryInvoiceAttachmentAsync(string?, string?, CancellationToken)

Get the Cross-Industry Invoice of the Factur-X document.

csharp
public Task<CrossIndustryInvoiceAttachment?> GetCrossIndustryInvoiceAttachmentAsync(string? attachmentFileName = null, string? password = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<FacturXDotNet.CrossIndustryInvoiceAttachment>: The Cross-Industry Invoice of the Factur-X document.

Parameters
TypeNameDescription
System.StringattachmentFileNameThe name of the attachment containing the Cross-Industry Invoice XML file. If not specified, the default name 'factur-x.xml' will be used.
System.StringpasswordThe password to open the PDF document.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetAttachmentsAsync(string?, CancellationToken)

Get the attachments of the Factur-X document.

csharp
public IAsyncEnumerable<FacturXDocumentAttachment> GetAttachmentsAsync(string? password = null, CancellationToken cancellationToken = default)
Returns

System.Collections.Generic.IAsyncEnumerable<FacturXDotNet.FacturXDocumentAttachment>: The attachments of the Factur-X document.

Parameters
TypeNameDescription
System.StringpasswordThe password to open the PDF document.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

ExportAsync(Stream)

Export the Factur-X document to a stream.

csharp
public Task ExportAsync(Stream outputStream)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.IO.StreamoutputStreamThe stream to write the Factur-X document to.

Create()

Create a new Factur-X document builder. The builder must be configured with the desired PDF image, Cross-Industry Invoice, XMP metadata.

csharp
public static FacturXDocumentBuilder Create()
Returns

FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder

LoadFromFileAsync(string, CancellationToken)

Create a new Factur-X document from a file.

csharp
public static Task<FacturXDocument> LoadFromFileAsync(string filePath, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<FacturXDotNet.FacturXDocument>

Parameters
TypeName
System.StringfilePath
System.Threading.CancellationTokencancellationToken

LoadFromStream(Stream, CancellationToken)

Create a new Factur-X document from a stream.

csharp
public static Task<FacturXDocument> LoadFromStream(Stream stream, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<FacturXDotNet.FacturXDocument>

Parameters
TypeName
System.IO.Streamstream
System.Threading.CancellationTokencancellationToken

LoadFromBuffer(ReadOnlyMemory<byte>)

Create a new Factur-X document from a buffer.

csharp
public static FacturXDocument LoadFromBuffer(ReadOnlyMemory<byte> buffer)
Returns

FacturXDotNet.FacturXDocument

Parameters
TypeName
System.ReadOnlyMemory<System.Byte>buffer

The tools are open source and released under the MIT License, feel free to use, modify, and share.