Skip to content

Class FacturXDocumentAttachment

A file attached to the Factur-X PDF.

Assembly: FacturXDotNet.dll
csharp
public class FacturXDocumentAttachment

Derived:
FacturXDotNet.CrossIndustryInvoiceAttachment

Properties

Name

The name of the attachment.

csharp
public string Name { get; }

Methods

ReadAsync(string?, CancellationToken)

Read the attachment from the Factur-X document to memory.

csharp
public Task<ReadOnlyMemory<byte>> ReadAsync(string? password = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<System.ReadOnlyMemory<System.Byte>>: The attachment content.

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

System.InvalidOperationException
The attachment with the specified name could not be found.

CopyToAsync(Stream, string?, CancellationToken)

Write the attachment from the Factur-X document to a stream.

csharp
public Task CopyToAsync(Stream outputStream, string? password = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.IO.StreamoutputStreamThe stream to write the attachment to.
System.StringpasswordThe password to open the PDF document.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

FindAttachmentStreamAsync(string?, CancellationToken)

Get the stream of the attachment from the Factur-X document.

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

System.Threading.Tasks.Task<System.IO.Stream>: The attachment stream.

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

System.InvalidOperationException
The attachment with the specified name could not be found.

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