EulandaXtools — Funktionsreferenz
Fügt einer Peppol-UBL-Rechnung ein oder mehrere Attachments als EmbeddedDocumentBinaryObject hinzu.
Add-PeppolInvoiceAttachment [-UblXml] <xml> [-UblPath] <string> [-AttachmentPath] <string[]>
[[-DocumentType] <string>] [[-FileName] <string>] [[-MimeType] <string>] [[-OutputPath]
<string>]Ergänzt eine bestehende Peppol BIS Billing 3.0 / UBL 2.1 Invoice um eingebettete Attachments (Base64 in cac:AdditionalDocumentReference / cac:Attachment / cbc:EmbeddedDocumentBinaryObject).
Wichtig:
-UblXml
Type: xmlUBL-Invoice als [xml]-Objekt.
-UblPath
Type: stringPfad zu einer bestehenden UBL-Datei.
-AttachmentPath
Type: string[]Pfad zu einer oder mehreren Dateien, die eingebettet werden sollen.
-DocumentType
Type: string
Default: 'Invoice PDF'Beschreibung des Attachments (wird als cbc:DocumentDescription geschrieben), z. B. "Invoice PDF".
-FileName
Type: stringOptionaler Dateiname für das Attachment (Attribut "filename" am EmbeddedDocumentBinaryObject). Bei mehreren Attachments wird bei Bedarf automatisch ein Suffix angehängt, damit der Dateiname eindeutig bleibt.
-MimeType
Type: string
Default: 'application/pdf'MIME-Type des Attachments. Standard: application/pdf
-OutputPath
Type: stringOptionaler Pfad zum Speichern der modifizierten UBL.
System.Xml.XmlDocument# UBL aus Datei laden, PDF einbetten und Ergebnis speichern
Add-PeppolInvoiceAttachment -UblPath 'C:\Temp\invoice.xml' -AttachmentPath 'C:\Temp\invoice.pdf' -OutputPath 'C:\Temp\invoice.with-attachment.xml'# Bereits geladenes XML-Objekt erweitern und als XML zurückgeben
$ubl = [xml](Get-Content -Raw -Path 'C:\Temp\invoice.xml')
$result = Add-PeppolInvoiceAttachment -UblXml $ubl -AttachmentPath 'C:\Temp\invoice.pdf'
$result.OuterXml | Out-File -Encoding utf8 'C:\Temp\invoice.with-attachment.xml'# Mehrere Attachments einbetten (Dateinamen werden bei Bedarf automatisch eindeutig gemacht)
Add-PeppolInvoiceAttachment -UblPath 'C:\Temp\invoice.xml' -AttachmentPath @('C:\Temp\a.pdf','C:\Temp\b.pdf') -DocumentType 'Arbeitsnachweis' -MimeType 'application/pdf'