THotPDF.IsLoadedSourceStreamAlias Method
function IsLoadedSourceStreamAlias(Stream: TStream): Boolean;
Returns True when Stream is a retained source, random-access input, incremental input, or graph-reload stream, or when its Windows file identity matches a retained source file or an original file identity captured by an authenticated snapshot
File identity uses the volume serial number and file index, allowing separate handles and hard links to be recognized; a source loaded by filename is checked through its recorded source path
The method is read-only and does not seek or change stream positions; nil returns False
Keep a caller-owned source stream alive while the document still borrows it
Signed or encrypted stream loads retain an independently owned authenticated snapshot; after that snapshot is established, the caller may release or replace the original input stream
A detached original memory stream is no longer the retained backing source, and its former object address is not an alias identity; a new output allocated at that address remains valid
The captured original file identity still protects the same underlying file through the original handle, a separate handle, or a hard link
Opaque custom stream wrappers and arbitrary random-access providers may hide their underlying identity, so the caller must ensure that such an output cannot overwrite source storage
Call this method before any truncating or modifying file operation; constructing a TFileStream with fmCreate has already truncated its file before alias checking can protect it
For conversion to a filename, use HPDFConvertLoadedToPDFA4RasterFile, which checks existing target identity before creating temporary output and publishing it