function ReadPdfVersionInfo(Source: TStream; out Info: TPdfVersionInfo; out ErrorText: string): Boolean;
| HeaderVersion | Version from the %PDF-M.m header, encoded as 13 to 17 |
| CatalogVersion | Version from the catalogue /Version name when present |
| CoreVersion | Effective core version, always the higher of header and catalogue versions |
| AdobeBaseVersion | ADBE developer-extension /BaseVersion |
| AdobeExtensionLevel | Positive ADBE /ExtensionLevel |
| HasCatalogVersion | True when a valid top-level catalogue /Version exists |
| HasDeveloperExtensions | True when the catalogue contains a top-level /Extensions dictionary |
| HasAdobeExtension | True when a valid ADBE extension dictionary exists |
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
Info: TPdfVersionInfo;
ErrorText: string;
if ReadPdfVersionInfo(Stream, Info, ErrorText) then
Memo1.Lines.Add(Format('PDF 1.%d', [Info.CoreVersion mod 10]));