PDFium Delphi Component Docs

ReadPdfVersionInfo function

Unit: FPdfCompress
Reads version declarations and developer-extension metadata directly from a seekable PDF stream

Syntax

function ReadPdfVersionInfo(Source: TStream; out Info: TPdfVersionInfo; out ErrorText: string): Boolean;

TPdfVersionInfo fields

HeaderVersionVersion from the %PDF-M.m header, encoded as 13 to 17
CatalogVersionVersion from the catalogue /Version name when present
CoreVersionEffective core version, always the higher of header and catalogue versions
AdobeBaseVersionADBE developer-extension /BaseVersion
AdobeExtensionLevelPositive ADBE /ExtensionLevel
HasCatalogVersionTrue when a valid top-level catalogue /Version exists
HasDeveloperExtensionsTrue when the catalogue contains a top-level /Extensions dictionary
HasAdobeExtensionTrue when a valid ADBE extension dictionary exists

Description

Returns True only when the header, latest trailer, document catalogue and every declared developer-extension entry are structurally readable

The catalogue and extension scan follows the current startxref, /Prev and hybrid /XRefStm chain, including active type 2 entries in object streams, whilst ignoring superseded, freed and unreferenced object bodies

Within one hybrid revision, supplementary /XRefStm entries take precedence over classic compatibility-table placeholders for the same object number

PDF name #xx escapes are decoded during key and value matching, and extension levels must be complete positive integer tokens

The function leaves core-version and developer-extension declarations separate because an extension does not change the ISO core version

Example

Info: TPdfVersionInfo;
ErrorText: string;
if ReadPdfVersionInfo(Stream, Info, ErrorText) then
  Memo1.Lines.Add(Format('PDF 1.%d', [Info.CoreVersion mod 10]));

See Also

TPdf.PdfVersion, TPdf.SaveAs