SetEmbeddedFileAFRelationshipA

PDF/UA 與無障礙

描述

結尾的 A 表示 ANSI(char)DLL 進入點,ActiveX/COM 介面僅公開 Unicode 形式。其行為與 SetEmbeddedFileAFRelationship 相同,字串引數會依據目前的 SetAnsiMode 字碼頁進行解譯

為內嵌檔案在檔案規格字典上設定 AFRelationship 金鑰。內嵌檔案出現在無障礙 PDF 文件時,ISO 14289-1(PDF/UA-1)§7.11 有此要求。

語法

Delphi

Function DLSetEmbeddedFileAFRelationshipA(InstanceID, Index: Integer; AFRelationship: PAnsiChar): Integer;

DLL

int DLSetEmbeddedFileAFRelationshipA(int InstanceID, int Index, const char * AFRelationship);

參數

Index內嵌檔案的索引(零起算)。有效範圍:0 到 EmbeddedFileCount - 1。
AFRelationship內嵌檔案與文件的關聯。必須是下列其中一個值(區分大小寫):

Source — 內嵌檔案是建立文件所用的來源檔
Data — 內嵌檔案含有文件使用的資料
Alternative — 內嵌檔案是文件內容的替代表示
Supplement — 內嵌檔案是文件的補充
Unspecified — 未指定關聯(SetPDFUAMode 啟用時的預設)

傳回值

成功傳回 1。索引超出範圍、AFRelationship 值不是五個有效值之一,或沒有開啟的文件時傳回 0。

備註

SetPDFUAMode 作用中時,PDF Library for Delphi 會在文件儲存時,自動為缺少 AFRelationship 的內嵌檔案補上 Unspecified

加入內嵌檔案之後、儲存文件之前,先呼叫此函式

範例

// PDF/A-3 archive that embeds an XLSX as the document's source data
var
  FileID: Integer;
begin
  PDF.SetPDFAMode(5);              // PDF/A-3b — allows arbitrary embedded files
  PDF.NewDocument;
  PDF.AddStandardFont('Helvetica');
  PDF.AddPage;
  PDF.PrintText(50, 750, 'Quarterly Sales Report');

  FileID := PDF.AddEmbeddedFile(
    'sales-Q1.xlsx',
    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  PDF.AddFileAttachment('Source spreadsheet', FileID);

  // Mark the relationship: the spreadsheet is the source of the report
  PDF.SetEmbeddedFileAFRelationship(1, 'Source');

  PDF.SaveToFile('report-PDFA3b.pdf');
end;

另見

SetPDFUAMode, SetPDFAMode, AddFileAttachment, AddEmbeddedFile, EmbedFile, SetEmbeddedFileStrProperty