function ReadPdfVersionInfo(Source: TStream; out Info: TPdfVersionInfo; out ErrorText: string): Boolean;
| HeaderVersion | Version from the %PDF-M.m header, encoded as 13 through 17 |
| CatalogVersion | Version from the catalog /Version name when present |
| CoreVersion | Effective core version, always the higher of header and catalog versions |
| AdobeBaseVersion | ADBE developer-extension /BaseVersion |
| AdobeExtensionLevel | Positive ADBE /ExtensionLevel |
| HasCatalogVersion | True when a valid top-level catalog /Version exists |
| HasDeveloperExtensions | True when the catalog contains a top-level /Extensions dictionary |
| HasAdobeExtension | True when a valid ADBE extension dictionary exists |
Returns True only when the header, latest trailer, document catalog and every declared developer-extension entry are structurally readable
The catalog and extension scan follows the current startxref, /Prev and hybrid /XRefStm chain, including active type 2 entries in object streams, while ignoring superseded, freed and unreferenced object bodies
Within one hybrid revision, supplemental /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
Info: TPdfVersionInfo;
ErrorText: string;
if ReadPdfVersionInfo(Stream, Info, ErrorText) then
Memo1.Lines.Add(Format('PDF 1.%d', [Info.CoreVersion mod 10]));