PDFium Delphi Component Docs

SaveAsRepaired method

Component: TPdf  ·  Unit: PDFium
Write a full single-revision copy of a damaged document and strict-load it before delivering the result

Syntax

function SaveAsRepaired(Stream: TStream; out Report: TPdfRepairReport; AllowSignedDocument: Boolean = False): Boolean;

StreamTStream. Destination stream
ReportTPdfRepairReport. Receives SourceUsedRecovery, OutputByteCount, OutputPageCount, OutputCrossReferenceTableValid, Succeeded, ErrorMessage, and a Verification load report for the independent re-load
AllowSignedDocumentBoolean. Permit rewriting a signed document. Defaults to False
ResultBoolean. True when a verified copy was written

 

function SaveAsRepaired(const FileName: string; out Report: TPdfRepairReport; AllowSignedDocument: Boolean = False): Boolean;

FileNamestring. Destination file, written atomically through a temporary file in the same directory
ReportTPdfRepairReport. Same report record as the stream overload
AllowSignedDocumentBoolean. Permit rewriting a signed document
ResultBoolean. True when a verified copy was written

Description

Meant for documents that only opened because recovery rebuilt their cross-reference table. The copy is written as a single clean revision, so the damaged structure is replaced rather than appended to

The output is then loaded again in strict mode by an independent load, and that load report is returned in Verification. A repair that cannot be re-loaded strictly reports failure instead of handing back a file that merely looks written

SourceUsedRecovery records whether the input needed recovery in the first place, which is what LastLoadReport reports after loading

See Also

LoadDocument, LastLoadReport, CrossReferenceTableValid, SaveAs