PDFiumVCL Docs

Author property

Denna API-post behåller identifierare, signaturer, kodblock och PDF-termer i ursprunglig form.
Component: TPdf  ·  Unit: PDFium
Returns the value of the /Author entry from the PDF document information dictionary.

Syntax

property Author: WString; // read only

Description

Author returns the human-readable name of the person or organization that authored the original document. Internally the property is a thin wrapper around MetaText['Author'], which in turn calls PDFium's FPDF_GetMetaText to read the /Author string from the document's information dictionary (the dictionary referenced by the trailer's /Info key — see ISO 32000-1, section 14.3.3 "Document Information Dictionary").

If the document does not declare an author, or if the document is not currently loaded, the result is an empty WString. The property never raises — an empty string is the correct sentinel for "no author recorded". Because the underlying PDFium API decodes the raw PDFDocEncoding or UTF-16BE byte string into UTF-16 for you, the result is always returned in the native Delphi WideString encoding and is safe to assign directly to a TStrings, TLabel, or any other Unicode-aware surface.

The property is read-only. To set the author on a newly created or loaded document, use the lower-level FPDF_SetMetaText import against the Document handle, or author/refresh an XMP packet through the metadata stream.

Remarks

Example

procedure TForm1.ShowDocumentInfo;
begin
  Pdf1.FileName := 'C:\Docs\Report.pdf';
  Pdf1.Active := True;
  try
    Memo1.Lines.Add('Title: ' + Pdf1.Title);
    Memo1.Lines.Add('Author: ' + Pdf1.Author);
    Memo1.Lines.Add('Subject: ' + Pdf1.Subject);
    if Pdf1.Author = '' then
      Memo1.Lines.Add(' (no /Author entry in info dictionary)');
  finally
    Pdf1.Active := False;
  end;
end;

See Also

Title, Subject, Creator, Producer, Keywords, MetaText, CreationDate, ModifiedDate