PDFiumPas 文档

Subject 属性

此 API 条目保留标识符、签名、代码块和 PDF 术语的原始形式。
组件: TPdf  ·  单元: PDFium
返回 PDF 文档信息字典中 /Subject 条目的值

语法

property Subject: WString; // read only

说明

Subject 返回文档信息字典中的 /Subject 条目,也就是一段简短的、自由格式的说明,用来描述文档在讲什么。此属性会委托给 MetaText['Subject'],后者会针对该键调用 PDFium 的 FPDF_GetMetaText。该字段与 /Title/Author/Keywords 一起定义在 ISO 32000-1 § 14.3.3 中

当文档没有 /Subject 条目、尚未加载,或者尾部的 /Info 引用完全缺失时,此属性返回空 WString,不会抛出异常

从概念上讲,/Subject 回答的是“这是什么文档”,而 /Title 回答的是“这个文档叫什么名字”。在实践中,许多生成器会把 Subject 留空,因此应把它视为可选的补充文本,而不是必填字段

备注

示例

procedure TForm1.DumpMetadataToGrid;
begin
  Pdf1.Active := True;
  StringGrid1.Cells[0, 0] := 'Field';
  StringGrid1.Cells[1, 0] := 'Value';
  StringGrid1.Cells[0, 1] := 'Title';
  StringGrid1.Cells[1, 1] := Pdf1.Title;
  StringGrid1.Cells[0, 2] := 'Subject';
  StringGrid1.Cells[1, 2] := Pdf1.Subject;
  StringGrid1.Cells[0, 3] := 'Author';
  StringGrid1.Cells[1, 3] := Pdf1.Author;
end;

另请参阅

Title, Author, Keywords, Creator, MetaText