RepairQDFFile

Debugging, Document repair

Description

Repairs a QDF PDF after human edits have changed stream lengths or object byte positions

The repair pass scans object boundaries without trusting stale cross-reference offsets, recalculates stream lengths, updates indirect length objects, and rebuilds the free list, cross-reference table, trailer, startxref, and /Size

Stream data containing endstream and endobj lines is preserved when the object has an unambiguous QDF stream marker. Invalid QDF input and repeated markers for the same object are rejected before the destination is opened, preserving an existing output file even during in-place repair

Syntax

Delphi

Function TPDFlib.RepairQDFFile(Const InputFileName, OutputFileName: WideString): Integer;

DLL

int DLRepairQDFFile(int InstanceID, const wchar_t* InputFileName, const wchar_t* OutputFileName);

ActiveX

Function PDFlib::RepairQDFFile(InputFileName As String, OutputFileName As String) As Long

Parameters

InputFileNameThe edited QDF PDF
OutputFileNameThe repaired PDF path, which may be identical to the input path

Return values

1The edited QDF was repaired
0The input was not a repairable QDF or the destination could not be written

Errors

LastErrorCode 106 reports invalid QDF structure, 107 reports repair failure, and 305 reports an output write failure

Remarks

In-place repair is safe because the complete source is read before the destination is replaced