/Subject 項目的值property Subject: WString; // read only
Subject 會回傳文件的 /Subject info-dictionary 項目,也就是一段簡短、自由格式的描述,用來說明文件是在講什麼。這個屬性會轉呼叫 MetaText['Subject'],實際上是透過 PDFium 的 FPDF_GetMetaText 取出該鍵值。這個欄位在 ISO 32000-1 § 14.3.3 中與 /Title、/Author、/Keywords 並列定義
當文件沒有 /Subject 項目、尚未載入,或 trailer 的 /Info 參照完全缺失時,這個屬性會回傳空的 WString,不會拋出例外
概念上 /Subject 回答的是「這份文件在說什麼」,而 /Title 回答的是「這份文件叫什麼名字」。實務上很多產生器都會把 Subject 留白,所以應把它視為可選的補充文字,而不是必填欄位
True,未啟用的元件會直接回傳空字串而不拋出例外WString 都是可直接使用的 Unicodedc:description 屬性,PDF/A 文件需要讓這兩種表示方式保持同步
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;