THotPDF.ScrubLoadedRedactionRemnants
Permanently removes residual private data and unreachable objects after loaded-document redaction
Delphi syntax
function ScrubLoadedRedactionRemnants( out Report: THPDFSanitiseReport): Boolean;
Description
The method applies the spRedactionCleanup sanitization profile to the complete loaded object graph
It removes Redact and file-attachment annotations, the trailer document-information dictionary, Catalog or page XMP metadata, private /PieceInfo metadata, embedded-file name trees, associated files, portfolios, and their detached payload streams
A cycle-safe reachability pass then deletes every indirect object no longer reachable from the Catalog, including unused fonts, font programs, images, Form XObjects, metadata streams, annotations, and payload objects. Live object numbers are compacted in linear time
The method disables incremental saving and forces the next loaded-document save to perform a complete rewrite, so removed bytes cannot survive in an earlier revision
Unrelated actions, page content, navigation, forms, and annotations are preserved. Use SanitiseLoadedDocument when active content must also be removed
Report
MetadataEntriesRemoved, RedactAnnotationsRemoved, EmbeddedFilesRemoved, PayloadStreamsRemoved, UnreachableObjectsRemoved, and PriorRevisionBytesDiscarded provide cleanup telemetry
Example
var
Report: THPDFSanitiseReport;
begin
PDF.LoadFromFile('redacted-source.pdf');
PDF.ApplyLoadedRedactions;
if not PDF.ScrubLoadedRedactionRemnants(Report) then
raise Exception.Create('Redaction cleanup was rejected');
PDF.SaveLoadedDocument('redacted-final.pdf');
end;
See also ApplyLoadedRedactions and Loaded Document Sanitization