PDFium Delphi Component Docs

Subject 屬性

元件: TPdf  ·  單元: PDFium
回傳 PDF 文件資訊字典中 /Subject 項目的值

語法

property Subject: WString; // read only

說明

Subject 傳回文件的 /Subject 資訊字典項目 — 也就是描述文件主題的簡短自由文字。此屬性委派給 MetaText['Subject'],後者會針對該鍵呼叫 PDFium 的 FPDF_GetMetaText。此欄位定義於 ISO 32000-1 § 14.3.3,與 /Title、/Author 和 /Keywords 並列

當文件沒有 /Subject 項目、文件尚未載入,或 trailer 的 /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