Class FacturXDocumentBuilder
Assembly: FacturXDotNet.dll
public class FacturXDocumentBuilder
Methods
SetLogger(ILogger?)
Set the logger that will be used during the call to FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.BuildAsync().
public FacturXDocumentBuilder SetLogger(ILogger? logger)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Logging.ILogger | logger | The logger to use. |
UsePdfGenerator(IPdfGenerator)
Sets the PDF generator to be used for creating the Factur-X document. Using this method will replace the currently set PDF generator and cancel any previous calls to FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.UsePdfGenerator(FacturXDotNet.Generation.PDF.IPdfGenerator), FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.WithStandardPdf() or FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.WithBasePdf(System.IO.Stream%2cSystem.Action%7bFacturXDotNet.Generation.FacturX.BasePdfStreamOptions%7d)
.
public FacturXDocumentBuilder UsePdfGenerator(IPdfGenerator generator)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
FacturXDotNet.Generation.PDF.IPdfGenerator | generator | The PDF generator to use. |
WithStandardPdf()
Sets the PDF generator of the builder to the standard generator. The standard generator is the default generator used when no custom generator is provided.
public FacturXDocumentBuilder WithStandardPdf()
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.### WithBasePdf(Stream, Action<BasePdfStreamOptions>?) Set the base PDF image for the Factur-X document. The builder will edit this PDF image to add the XMP metadata, the Cross Industry Invoice and other attachments, then save it to the output stream.
public FacturXDocumentBuilder WithBasePdf(Stream pdfImageStream, Action<BasePdfStreamOptions>? configure = null)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | pdfImageStream | The stream containing the base PDF image. |
System.Action<FacturXDotNet.Generation.FacturX.BasePdfStreamOptions> | configure | An optional action to configure the base PDF stream options, such as setting a password or indicating whether the stream should remain open after |
processing. |
WithCrossIndustryInvoice(CrossIndustryInvoice, Action<CrossIndustryInvoiceOptions>?)
Set the Cross Industry Invoice data for the Factur-X document. The data will be added as an attachment to the PDF document.
public FacturXDocumentBuilder WithCrossIndustryInvoice(CrossIndustryInvoice cii, Action<CrossIndustryInvoiceOptions>? configure = null)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
FacturXDotNet.Models.CII.CrossIndustryInvoice | cii | The Cross Industry Invoice (CII) data that contains the structured invoice details to be attached to the Factur-X document. |
System.Action<FacturXDotNet.Generation.FacturX.CrossIndustryInvoiceOptions> | configure | An optional action to configure additional options for the invoice attachment. |
WithCrossIndustryInvoice(Stream, Action<CrossIndustryInvoiceStreamOptions>?)
Set the Cross Industry Invoice data for the Factur-X document. The data will be added as an attachment to the PDF document.
public FacturXDocumentBuilder WithCrossIndustryInvoice(Stream cii, Action<CrossIndustryInvoiceStreamOptions>? configure = null)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | cii | The Cross Industry Invoice data. |
System.Action<FacturXDotNet.Generation.FacturX.CrossIndustryInvoiceStreamOptions> | configure | An optional action to configure additional options for the invoice attachment. |
WithXmpMetadata(XmpMetadata)
Set the XMP metadata for the Factur-X document. The metadata will be added as-is to the PDF document, it will replace any existing metadata found in the document.
public FacturXDocumentBuilder WithXmpMetadata(XmpMetadata xmp)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
FacturXDotNet.Models.XMP.XmpMetadata | xmp | The XMP metadata. |
WithXmpMetadata(Stream, Action<XmpMetadataStreamOptions>?)
Set the XMP metadata for the Factur-X document. The metadata will be added as-is to the PDF document, it will replace any existing metadata found in the document.
public FacturXDocumentBuilder WithXmpMetadata(Stream xmpStream, Action<XmpMetadataStreamOptions>? configure = null)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | xmpStream | The stream containing the XMP metadata. |
System.Action<FacturXDotNet.Generation.FacturX.XmpMetadataStreamOptions> | configure | An optional action to configure additional options for the invoice attachment. |
PostProcess(Action<FacturXDocumentPostProcessOptions>)
Post-process the XMP metadata after it has been added to the PDF document. The metadata is either provided as-is using one of the FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.WithXmpMetadata(FacturXDotNet.Models.XMP.XmpMetadata) overloads, or a combination of the existing metadata of the base PDF and the CII data.
public FacturXDocumentBuilder PostProcess(Action<FacturXDocumentPostProcessOptions> postProcess)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
System.Action<FacturXDotNet.Generation.FacturX.FacturXDocumentPostProcessOptions> | postProcess | The action to perform on the XMP metadata. |
WithAttachment(PdfAttachmentData, Action<AttachmentOptions>?)
Add an attachment to the Factur-X document.
public FacturXDocumentBuilder WithAttachment(PdfAttachmentData attachment, Action<AttachmentOptions>? configure = null)
Returns
FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder: The builder itself for chaining.
Parameters
Type | Name | Description |
---|---|---|
FacturXDotNet.Generation.PDF.PdfAttachmentData | attachment | The attachment to add. |
System.Action<FacturXDotNet.Generation.FacturX.AttachmentOptions> | configure | An optional action to configure additional options for the invoice attachment. |
BuildAsync()
Create a new Factur-X document.
public Task<FacturXDocument> BuildAsync()
Returns
System.Threading.Tasks.Task<FacturXDotNet.FacturXDocument>
: The Factur-X document.## Extension Methods
- FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.FacturXDotNet.Generation.FacturX.FacturXDocumentBuilderFileExtensions.WithBasePdfFile(System.String,System.String)
- FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.FacturXDotNet.Generation.FacturX.FacturXDocumentBuilderFileExtensions.WithCrossIndustryInvoiceFile(System.String,System.String)
- FacturXDotNet.Generation.FacturX.FacturXDocumentBuilder.FacturXDotNet.Generation.FacturX.FacturXDocumentBuilderFileExtensions.WithXmpMetadataFile(System.String)