THotPDF.LoadAuthenticatedRevisionFromRandomAccessSource
Loads an encryption-preserving revision through a seekable byte source while borrowing the credential another component already authenticated
Declaration
function LoadAuthenticatedRevisionFromRandomAccessSource(
Source: THPDFRandomAccessSource; CredentialSource: THotPDF;
OwnsSource: boolean= false): Integer;
Contract
- Borrowing requires an independent credential document:
SourceandCredentialSourcemust be non-nil andCredentialSourcemust differ from the component being loaded, otherwiseEArgumentExceptionis raised - The credential is a library-verified identity, never a caller assertion; its raw encryption object body and permanent file identifier are compared against the actual source bytes before any borrowed key decrypts a byte, and a revision with any other encryption identity is refused with
EInvalidOpExceptioninstead of decrypted - The encryption policy must match the credential: an encrypted revision requires an encrypted credential and an unencrypted revision requires an unencrypted one, otherwise
EInvalidOpExceptionis raised - The loaded document adopts the credential's file key, owner-authentication state, stream-key type, object-stream encryption policy and delay state, so a later decrypt or edit path reuses the exact security identity that was re-verified here
- Loading observes the operation cancellation token while reading and verifying the source
GetSizereturns the stable byte length and must not return a negative value, andReadAtreads at the supplied zero-based offset, exactly as for LoadFromRandomAccessSource- An ordinary source is wrapped in a bounded range-coalescing, caching source and HotPDF owns that wrapper; an existing
THPDFCoalescingRandomAccessSourcekeeps the caller-selected block, cache, ownership and prefetch settings - When HotPDF owns the source it frees it on a later load, on load failure and on component destruction; a caller-owned source must remain valid while the loaded document is in use
- The method shares the verification contract of
LoadAuthenticatedRevisionFromStream
The result is the loaded page count, matching LoadFromStream and LoadFromFile; if the authenticated revision cannot be verified the source is released and no revision is loaded
See also: LoadFromRandomAccessSource, PrepareLoadedFormDataRevisionToStream, Loaded annotation import policies