THotPDF imported resource deduplication
Reuses equivalent immutable resources while pages are copied from one or more source documents into the same destination
Delphi syntax
function GetImportedResourceDedupStatistics( out Statistics: THPDFImportedResourceDedupStatistics): boolean; procedure ClearImportedResourceDedupCache;
Description
CopyPageFromDocument and related graph-copy paths create canonical SHA-256 fingerprints for indirect image, Form XObject, Pattern, embedded font program, Font, and ExtGState resources. Dictionary keys are ordered before hashing, indirect dependencies are resolved, and stream content is hashed without changing its current position
The cache belongs to the destination document and remains available across page copies and across different source document instances. It is cleared automatically when a new document or loaded parse graph begins, or when a graph transaction commits or rolls back
GetImportedResourceDedupStatistics returns the number of cached resources plus cache hits and misses. ClearImportedResourceDedupCache clears both entries and counters without changing objects already present in the destination document
Only indirect resources are shared. Page dictionaries, annotations, content streams, and arbitrary mutable dictionaries continue to receive independent copies
See also CopyPageFromDocument