AddAttachments2PDF

Methode (Function) · gibt Boolean zurück

AddAttachments2PDF ist eine Methode der Klasse Aloaha_ZUGFeRD.XML im Aloaha ZUGFeRD SDK.

Beschreibung (Originaltext der englischen SDK-Dokumentation): Embeds one or more files as attachments into a PDF file.

Rückgabe: True if the attachments were added and the output file exists; False otherwise (see Last_Error).

Deklaration

Public Function AddAttachments2PDF(ByVal InputPDF As String, ByVal AttachmentFileList() As String, ByVal OutPutPDF As String, ByVal DoOverWrite As Boolean, ByVal Licensekey As String) As Boolean

Parameter

NameTypPflichtBeschreibung
InputPDFStringerforderlichPath of the input PDF file
AttachmentFileListString()erforderlichPaths of the files to attach; empty or non-existing paths are skipped
OutPutPDFStringerforderlichPath of the output PDF file; if empty the input file is used
DoOverWriteBooleanerforderlichTrue allows overwriting an existing output file (required if output = input)
LicensekeyStringerforderlichLicence key, only used if the object is not yet licensed; if empty the key already set on the object or the global key is used

Aufruf (VB.NET)

Dim alo As New Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, False, "IHR-LIZENZSCHLUESSEL")
Dim InputPDF As String = ""
Dim AttachmentFileList As String() = Nothing
Dim OutPutPDF As String = ""
Dim DoOverWrite As Boolean = False
Dim Licensekey As String = ""
If Not alo.AddAttachments2PDF(InputPDF, AttachmentFileList, OutPutPDF, DoOverWrite, Licensekey) Then
    Console.WriteLine("Fehler: " & alo.Last_Error)
End If

Aufruf (C#)

var zfStandard = Aloaha_ZUGFeRD.iXML.ZUGFeRDVersion.xInvoice;   // Optional ByRef im Konstruktor: in C# mit ref übergeben
var alo = new Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, false, "IHR-LIZENZSCHLUESSEL", ref zfStandard);
string inputPDF = "";
string[] attachmentFileList = default;
string outPutPDF = "";
bool doOverWrite = false;
string licensekey = "";
if (!alo.AddAttachments2PDF(inputPDF, attachmentFileList, outPutPDF, doOverWrite, licensekey))
{
    Console.WriteLine("Fehler: " + alo.Last_Error);
}

COM-Schnittstelle

AddAttachments2PDF ist Mitglied der Schnittstelle Aloaha_ZUGFeRD.iXML (Position 113 von 343) und damit auch aus VB6, VBA/Access und anderen COM-Clients über CreateObject("Aloaha_ZUGFeRD.XML") aufrufbar. Neue Mitglieder werden immer am Ende von iXML angefügt, damit bestehende COM-Clients unverändert weiterlaufen; nach einem Update die Typbibliothek neu registrieren.

Quelle: XML-Dokumentationskommentare des Aloaha ZUGFeRD SDK (xml.vb). Gleiche Signatur in VB6/VBA über COM. In C# werden ByRef-Parameter mit ref übergeben, VB-Eigenschaften mit Parametern heißen get_…/set_…, optionale Parameter können entfallen.