THotPDF.AddFacturXAssociatedFile Method
方法摘要: THotPDF.AddFacturXAssociatedFile Method
宣告
function AddFacturXAssociatedFile(const XMLBytes : TBytes; const ConformanceLevel : AnsiString; const FileName : AnsiString = 'factur-x.xml'; const Description : AnsiString = 'Factur-X invoice XML'; const Relationship : AnsiString = 'Alternative'; const Version : AnsiString = '1.0'; const CountryCode : AnsiString = ''): THPDFDictionaryObject;
單元
HPDFDoc
參數
| 名稱 | 用途 |
|---|---|
XMLBytes | Invoice XML bytes embedded verbatim in the PDF/A-3 EmbeddedFile stream; the XML guideline or profile identifier must match ConformanceLevel |
ConformanceLevel | 允許的發票設定檔或符合性層級,例如 EN 16931、EXTENDED、XRECHNUNG,或 ZUGFeRD 1.0 的 COMFORT |
FileName | Embedded XML filename written to /F, /UF, the EmbeddedFiles name tree, and the XMP DocumentFileName value |
說明 | Optional Filespec /Desc text shown to consuming tools |
Relationship | Associated-file relationship written as /AFRelationship and allowed by the selected invoice profile |
Version | 發票中繼資料版本,可為 1.0、2p0,或對應的 XRECHNUNG 版本(例如 3.0) |
CountryCode | 設定檔驗證使用的地區政策代碼;可傳入空值、DE 或 FR |
傳回值
回傳為 primary invoice XML 註冊的 indirect Filespec dictionary
使用注意事項
- 使用此方法前,請將 PDFACompliance 設為 3A、3B 或 3U,並呼叫 BeginDoc
- 此方法會拒絕無效的 filename、profile 與 metadata-version 組合,因此 xrechnung.xml 只與 XRECHNUNG 搭配使用,ZUGFeRD-invoice.xml 只與 ZUGFeRD 1.0 profiles 搭配使用,zugferd-invoice.xml 只與 Version 2p0 搭配使用,而 factur-x.xml 用於目前 Factur-X profiles
- 此方法會依 ConformanceLevel 檢查 XML guideline 或 profile identifier,包括 ZUGFeRD 1.0 profile URNs、目前 Factur-X profile URNs、French EXTENDED subsets、EN16931 XMP 或 profile alias、ZUGFeRD 2.0 profile URNs,以及具有相符 metadata versions 的已知 XRechnung CII 或 UBL profile URNs
- 對 XRECHNUNG,請將 Version 傳為 1.2、2.0、2.1、2.2、2.3 或 3.0,以保留該 fx:Version;既有呼叫若將預設 Version 值保留為 1.0,會 normalize 為 3.0
- 對 ZUGFeRD 1.0 containers,請將 FileName 傳為 ZUGFeRD-invoice.xml,Version 傳為 1.0,ConformanceLevel 傳為 BASIC、COMFORT 或 EXTENDED
- 對 ZUGFeRD 2.0 containers,請將 FileName 傳為 zugferd-invoice.xml,Version 傳為 2p0
- 當 invoice container 必須遵循德國 ZUGFeRD relationship rules 時,CountryCode 請傳 DE;MINIMUM 與 BASIC WL 要求 Data 作為 AFRelationship,而 BASIC、EN 16931、EXTENDED 與 XRECHNUNG 要求 Alternative
- 當 invoice 必須遵循法國 Factur-X rules 時,CountryCode 請傳 FR;XRECHNUNG 會被拒絕,而 BASIC、EN 16931、EXTENDED、EXTENDED-CTC-FR 與 EXTENDED-B2B-FR 可使用 Alternative、Source 或 Data
- 此方法使用 MIME type text/xml,寫入 /Params /Size、/ModDate 與 /CheckSum,將 Filespec 註冊到 Catalog /AF,並為 XML extraction tools 新增 Catalog /Names /EmbeddedFiles entry
- primary invoice XML 註冊後,後續 AddPDFA3AssociatedFile 呼叫可加入 supporting documents;若這些 attachments 不屬於建議的 supporting-document formats,請檢查 FacturXWarnings 取得非致命 MIME type warnings
- 產生的 XMP packet 包含 profile-specific PDF/A extension schema,以及相符 invoice namespace 下的 DocumentType、DocumentFileName、Version 與 ConformanceLevel fields
- 使用此 helper 時不要設定 CustomXMP,因為呼叫端提供的 XMP packet 會取代產生的 invoice metadata
- 在一個 document workflow 中,只能透過此 helper 附加一個 primary invoice XML
相關 API
- THotPDF.AddPDFA3AssociatedFile Method
- THotPDF.FacturXWarnings Property
- THotPDF.AddPDFAOutputIntent Method
- THotPDF.PDFACompliance Property