Skip to content

Refactor out a method which adds the InvoiceDescriptor to a PdfDocument without saving. #873

@wertzui

Description

@wertzui

It the moment, there is only a way to work with the PDF file as a stream.
Inside of InvoiceDescriptorPdfSaver._CreateFacturXBytes(..) the PdfDocument is read from the Stream and then later saved to another Stream.

However when creating electronic invoices, it is often the case that you already have an instance of a PdfDocument, so saving reloading and then saving again adds additional overhead.

There should be a method, like the following which just adds the data from the InvoiceDescriptor to the already existing PdfDocument, like the following:

public static void AddElectronicInvoiceData(this PdfDocument outputDocument, InvoiceDescriptor descriptor, ...)

The logic stays the same and the existing method could just call the new method so it would not break anything and there would be no code duplication.

By making it an extension method on PdfDocument it also becomes visible and easily usable.
The user can then decide how to further process the PdfDocument if there is any need to, or just call PdfDocument.Save(...) if they need to save it..

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions