#[non_exhaustive]pub struct RecoveryReport {
pub reason: RecoveryReason,
pub file_level_objects: usize,
pub objstm_objects: usize,
pub last_wins_collisions: usize,
pub stream_lengths_recovered: usize,
pub missing_endobj_recovered: usize,
pub objects_dropped: Vec<DroppedObject>,
pub trailer_source: TrailerSource,
pub offset_start: bool,
}Expand description
The counted, disclosed record of a recovery (fuzzy-never-sneaky, R20).
Stored on the recovered crate::document::Document; surfaced by the
CLI (a diagnostic line + a distinct exit status) and the GUI (a
non-blocking banner). Every field is a fact an operator can act on, so
none is rounded away.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.reason: RecoveryReasonWhy the strict load failed (the originating cause).
file_level_objects: usizeObjects recovered by the file-level N G obj scan (type-1).
objstm_objects: usizeObjects recovered from /Type /ObjStm containers (type-2).
last_wins_collisions: usizeDuplicate object numbers resolved last-valid-wins among file-level definitions (how many times a number had more than one valid definition).
stream_lengths_recovered: usizeRecovered objects whose stream extent had to be re-derived from the
endstream keyword because the stored /Length was unusable
(absent, unresolvable, or simply not landing on endstream —
§7.3.8.2 defines /Length in terms of that keyword, so the two are
halves of one statement and this counts how often they disagreed).
Counted over the objects actually kept, not over every candidate
examined, so the number matches what the loaded document contains.
A non-zero value means some stream’s byte extent is pdfcer’s reading
of the file rather than the file’s own claim — the operator is told
(R20) because the two can differ, most visibly for a stream whose
binary data happens to contain the bytes endstream.
missing_endobj_recovered: usizeHow many definitions were accepted with no endobj keyword
(§7.3.10 requires one).
Non-zero means the file omitted a required terminator and pdfcer
bounded the object at the next N G obj header instead of dropping
it. Dropping is what pdfcer used to do, and it is how a document
whose catalog named an absent /Pages object got written — see
crate::parser::TerminatorPolicy. Disclosed, never silent (R20).
objects_dropped: Vec<DroppedObject>Objects the scan FOUND — a well-formed N G obj header at a byte
offset — and recovery could not keep, with the reason for each.
§Why this is a list and not a count (decision 145, owed item 18)
decision 145 obliges pdfcer to disclose what it dropped rather than
return a shorter document and no explanation. It closed that gap at
the loader; the recovery path had the same gap and was measured
having it on a real file: Annotations_output.pdf, whose startxref
points 134 bytes short of its own xref (a PDFsharp writer bug),
recovers 10 of 11 objects and drops object 5 — the page’s content
stream — with nothing recorded anywhere.
Losing that object is the CORRECT outcome: its Flate data is genuinely corrupt and keeping it would hand a caller bytes that cannot be decoded. Losing it silently is not, and the difference is the whole of rule 4 — an inference pdfcer made (this candidate is not usable) is disclosed, never silent.
A COUNT would not have been enough, and that is why this carries the
object number and the reason. The complaint that produced this item was
not “the number was wrong” — it was that a human holding a file with a
missing page could not find out WHICH object went or WHY. A bare
dropped: 1 answers neither.
trailer_source: TrailerSourceWhere the recovered trailer’s keys came from.
offset_start: boolWhether the %PDF- marker was not at byte 0 (offset-start /
leading-junk / headerless) — recovery handled it via absolute
offsets with no rebasing.