THotPDF.CreateIndirectFontDict Method

 

THotPDF.CreateIndirectFontDict

THotPDF

 

顶部

分配一个全新的空 THPDFDictionaryObject,并在文档的 IndirectObjects 表中注册为间接 PDF 对象。需要构建自定义 font / color / OCG / Function 字典、且必须序列化为 "N G R" 间接引用的调用方,填充返回的字典后,可把它传给任何接受现有 THPDFDictionaryObject 的 API。这是长期存在的受保护 CreateIndirectDictionary 辅助方法的公开 API 形式。

 

Delphi 语法:

function CreateIndirectFontDict: THPDFDictionaryObject;

 

C++ 语法:

THPDFDictionaryObject* CreateIndirectFontDict();

 

说明

返回的字典初始为空(无条目)。调用方通过 AddNameValue、AddStringValue、AddNumericValue、AddValue 等添加条目。字典由文档持有;不要手动释放。虽然方法名带 "FontDict"(主要预期用途是配合 SetFormUnicodeFontDict),但返回的字典没有任何字体专属语义 — 可以存放调用方需要的任何 PDF 字典内容。

 

Return value: an empty indirect THPDFDictionaryObject.

 

代码示例

// Build a minimal Type 0 / CIDFontType2 + Identity-H font dict for
// AcroForm Tx widget AP rendering
var
  F0: THPDFDictionaryObject;
begin
  HPDF.BeginDoc;
  F0 := HPDF.CreateIndirectFontDict;
  F0.AddNameValue('Type', 'Font');
  F0.AddNameValue('Subtype', 'Type0');
  F0.AddNameValue('BaseFont', 'MyCJK');
  F0.AddNameValue('Encoding', 'Identity-H');
  // ... fill DescendantFonts / CIDSystemInfo / FontDescriptor /
  HPDF.SetFormUnicodeFontDict('F0', F0);
  HPDF.EndDoc;
end;

 

另请参阅

SetFormUnicodeFontDict