AddPDFA3AssociatedFileFromString

文档属性

说明

从内存字节创建 embedded file stream,把 file specification 加入文档附件 name tree,并为 PDF/A-3 工作流注册到 Catalog /AF 数组

语法

Delphi

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

参数

FileName嵌入文件在 PDF 中显示的文件名,例如 invoice.xml
MIMETypeembedded file stream 的 MIME 类型,例如 text/xml 或 application/xml
Description写入 file specification /Desc 的可读说明,可为空
Relationship/AFRelationship 名称,接受 Source、Data、Alternative、Supplement 或 Unspecified
FileBytes要写入 embedded file stream 的原始字节

返回值

0没有活动文档、参数无效,或当前文档不在 PDF/A-3 模式
Non-zero新建 file specification 的对象句柄

备注

成功调用后,文件会出现在文档级附件列表中,并通过 Catalog /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