THotPDF.ScrubLoadedRedactionRemnants
Permanently removes residual private data and unreachable objects after loaded-document redaction
Delphi 语法
function ScrubLoadedRedactionRemnants( out Report: THPDFSanitiseReport): Boolean;
说明
该方法对完整的已加载对象图应用 spRedactionCleanup 清理配置
它会移除 Redact 和文件附件注释、trailer 中的文档信息字典、Catalog 或页面的 XMP 元数据、私有的 /PieceInfo 元数据、内嵌文件名称树、关联文件、portfolio,以及它们已分离的负载流
随后一遍防环的可达性分析,会删除所有不再能从 Catalog 到达的间接对象,包括未使用的字体、字体程序、图像、Form XObject、元数据流、注释和负载对象。存活的对象号会在线性时间内被压实
该方法会禁用增量保存,并强制下一次已加载文档的保存执行完整重写,因此被移除的字节不会残留在较早的修订中
无关的动作、页面内容、导航、表单和注释都会保留。还需要移除主动内容时,请使用 SanitiseLoadedDocument
Report
MetadataEntriesRemoved, RedactAnnotationsRemoved, EmbeddedFilesRemoved, PayloadStreamsRemoved, UnreachableObjectsRemoved,以及 PriorRevisionBytesDiscarded provide cleanup telemetry
示例
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;
另请参阅 ApplyLoadedRedactions 和 已加载文档净化