AddPDFA3AssociatedFileFromString

文件屬性

描述

從記憶體位元組建立內嵌檔案串流、把檔案規格加入文件附件名稱樹,並登錄到目錄的 /AF 陣列,供 PDF/A-3 流程使用

語法

Delphi

Function TPDFlib.AddPDFA3AssociatedFileFromString(Const FileName, MIMEType, Description, Relationship: WideString; Const FileBytes: AnsiString): Integer;

參數

FileName附件顯示的檔名,例如 invoice.xml
MIMEType寫入內嵌檔案串流的 MIME 類型,例如 text/xml 或 application/xml
Description寫入檔案規格的選配 /Desc 文字
Relationship/AFRelationship 值,通常為 Source、Data、Alternative、Supplement 或 Unspecified
FileBytes要存入內嵌檔案串流的原始位元組

傳回值

0沒有作用中的文件、引數無效,或目前文件未處於 PDF/A-3 模式
Non-zero新建檔案規格的物件控制代碼

備註

檔案會出現在文件附件清單中,同時被 PDF/A-3 關聯檔案要求的目錄 /AF 陣列參照

標準的 Factur-X、ZUGFeRD 或 XRechnung 發票 XML 請優先用 AddFacturXAssociatedFileFromString,發票中繼資料與設定檔檢查的寫入才會一致

範例

// Attach source XML to a PDF/A-3b document
var
  FileID: Integer;
begin
  PDF.SetPDFAMode(5);
  PDF.NewDocument;
  FileID := PDF.AddPDFA3AssociatedFileFromString(
    'invoice.xml',
    'text/xml',
    'Invoice source data',
    'Source',
    InvoiceXML);
  if FileID = 0 then Exit;
  PDF.SaveToFile('archive.pdf');
end;

另見

AddFacturXAssociatedFileFromString, SetPDFAMode, SetEmbeddedFileAFRelationship, AddEmbeddedFile