AddFacturXAssociatedFileFromString
Document properties
Description
เขียน XML ของใบแจ้งหนี้อิเล็กทรอนิกส์เป็นไฟล์ที่เกี่ยวข้องของ PDF/A-3 และสร้างเมทาดาตาใบแจ้งหนี้อิเล็กทรอนิกส์ XMP ที่จำเป็นสำหรับโปรไฟล์ Factur-X, ZUGFeRD และ XRechnung
Syntax
Delphi
Function TPDFlib.AddFacturXAssociatedFileFromString(Const XMLBytes: AnsiString; Const ConformanceLevel, FileName, Description, Relationship, Version, CountryCode: WideString): Integer;
Parameters
| XMLBytes | ไบต์ UTF-8 XML ดิบที่จะฝัง |
|---|---|
| ConformanceLevel | ระดับโปรไฟล์ใบแจ้งหนี้ เช่น MINIMUM, BASIC WL, BASIC, EN16931, EXTENDED, XRECHNUNG, EXTENDED-CTC-FR หรือ EXTENDED-B2B-FR |
| FileName | ชื่อไฟล์ XML ที่ฝังอยู่ ซึ่งมักจะเป็น factur-x.xml, xrechnung.xml, zugferd-invoice.xml หรือ ZUGFeRD-invoice.xml ค่าว่างจะเป็นค่าเริ่มต้นคือ factur-x.xml |
| Description | ข้อความ /Desc ที่ระบุหรือไม่ก็ได้ซึ่งเขียนลงในข้อกำหนดไฟล์ |
| Relationship | ค่า /AFRelationship โดยค่าว่างจะใช้ค่าเริ่มต้นเป็น Alternative |
| Version | เวอร์ชันโปรไฟล์ใบแจ้งหนี้ ค่าว่างจะเป็นค่าเริ่มต้นคือ 1.0 |
| CountryCode | รหัสโปรไฟล์ประเทศที่เป็นทางเลือก เช่น สตริงว่าง, DE หรือ FR |
Return values
| 0 | เอกสารไม่ได้อยู่ในโหมด PDF/A-3, การรวมกันของ XML หรือโปรไฟล์ไม่ถูกต้อง หรือ XML ใบแจ้งหนี้ถูกเพิ่มไปแล้ว |
|---|---|
| Non-zero | แฮนเดิลวัตถุของข้อกำหนดไฟล์ที่สร้างขึ้นใหม่ |
Remarks
เมธอดนี้จะตรวจสอบชื่อไฟล์ ระดับการสอดคล้อง เวอร์ชัน โปรไฟล์ประเทศ และ /AFRelationship ก่อนที่จะเขียนไฟล์แนบ
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
เมธอดนี้จะเขียนฟิลด์ XMP DocumentFileName, DocumentType, Version และ ConformanceLevel และตรวจสอบว่ารหัสแนวทาง XML ตรงกับโปรไฟล์ที่เลือก เนื้อหาหน้าใบแจ้งหนี้ปกติที่มองเห็นได้ยังคงถูกสร้างโดยผู้เรียกก่อนที่จะบันทึก
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