AddFacturXAssociatedFileFromString

Document properties

Description

Skriver e-faktura XML som en PDF/A-3-associeret fil og genererer de krævede XMP e-faktura-metadata for Factur-X-, ZUGFeRD- og XRechnung-profiler

Syntax

Delphi

Function TPDFlib.AddFacturXAssociatedFileFromString(Const XMLBytes: AnsiString; Const ConformanceLevel, FileName, Description, Relationship, Version, CountryCode: WideString): Integer;

Parameters

XMLBytesDe rå UTF-8 XML-bytes, der skal indlejres
ConformanceLevelFakturaprofilens niveau, såsom MINIMUM, BASIC WL, BASIC, EN16931, EXTENDED, XRECHNUNG, EXTENDED-CTC-FR eller EXTENDED-B2B-FR
FileNameDet indlejrede XML-filnavn, normalt factur-x.xml, xrechnung.xml, zugferd-invoice.xml eller ZUGFeRD-invoice.xml; en tom værdi har standarden factur-x.xml
DescriptionDen valgfrie /Desc-tekst skrevet til filspecifikationen
RelationshipVærdien for /AFRelationship; en tom værdi har standarden Alternative
VersionFakturaprofilens version; en tom værdi har standarden 1.0
CountryCodeEn valgfri landeprofilkode, såsom en tom streng, DE eller FR

Return values

0Dokumentet er ikke i en PDF/A-3-tilstand, XML- eller profilkombinationen er ugyldig, eller faktura-XML er allerede blevet tilføjet
Non-zeroObjekthåndtaget for den nyoprettede filspecifikation

Remarks

Metoden validerer filnavn, overensstemmelsesniveau, version, landeprofil og /AFRelationship, før bilaget skrives

COMFORT is accepted only with ZUGFeRD-invoice.xml and version 1.0; zugferd-invoice.xml selects the ZUGFeRD 2.0 profile, and xrechnung.xml selects the XRECHNUNG profile

Metoden skriver XMP-felterne DocumentFileName, DocumentType, Version og ConformanceLevel og kontrollerer, at XML-retningslinje-ID'et matcher den valgte profil; Det normale synlige fakturasideindhold oprettes stadig af opkalderen før lagring

Example

// Add EN 16931 invoice XML to a PDF/A-3b document
var
  FileID: Integer;
begin
  PDF.SetPDFAMode(5);
  PDF.NewDocument;
  FileID := PDF.AddFacturXAssociatedFileFromString(
    InvoiceXML,
    'EN16931',
    'factur-x.xml',
    'Factur-X invoice XML',
    'Alternative',
    '1.0',
    '');
  if FileID = 0 then Exit;
  PDF.SaveToFile('factur-x.pdf');
end;

See also

AddPDFA3AssociatedFileFromString, DetectFacturXInvoice, ValidateFacturXInvoice, ExtractFacturXXMLToString