From d51edec1bd7ef6c983d81b5ff0cf4ac5e2b022c4 Mon Sep 17 00:00:00 2001 From: Bundo Lee Date: Tue, 14 Jul 2026 17:31:13 +0900 Subject: [PATCH] fix: temporarily disable TOC detection until it is complete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Objective: PDF/UA-2 validation fails on documents where a table of contents is detected. The detected TOC cannot become a conformant structure: each entry must point at the section it references, but the pipeline never resolves that target, so the tagged output has no valid reference and fails clause 8.2.5.8.1. On top of that the detector is triggered too eagerly (any line ending in a number looks like a TOC entry), so it can even restructure ordinary body text. Approach: Turn the feature off at its single call site until it is finished, rather than shipping a half-working table of contents. A partial TOC is worse than none — an entry that points nowhere (or to the wrong place) sends a screen reader astray, and the false positives corrupt normal content. Detection is only commented out (the processor stays in the tree) so re-enabling is a one-line change once entry-target resolution and detection precision are done. With it off, the same text is tagged as ordinary paragraphs, which validates cleanly. Evidence: Rebuilt core with detection disabled and converted a document that previously triggered TOC detection. Before: TOC/TOCI elements emitted with no target -> PDF/UA-2 clause 8.2.5.8.1 failure (each TOCI must identify its reference target). After: veraPDF 1/1 pass; struct tree contains 0 TOC and 0 TOCI elements, the same text tagged as 7

paragraphs. No regression to normal documents (every text line flows through the existing paragraph path). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../pdf/processors/DocumentProcessor.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/processors/DocumentProcessor.java b/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/processors/DocumentProcessor.java index 64d6f8521..104e9d72b 100644 --- a/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/processors/DocumentProcessor.java +++ b/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/processors/DocumentProcessor.java @@ -367,7 +367,16 @@ private static List> processDocument(String inputPdfName, Config c if (structured) { // Cross-page operations (must be sequential) HeaderFooterProcessor.processHeadersAndFooters(contents, false); - new TableOfContentsProcessor().processTableOfContents(contents); + // TOC detection is temporarily disabled. It is not yet complete: + // - the heuristic has heavy false positives (any line ending in a + // bare number is treated as a TOC item), so it can restructure + // ordinary body content; + // - it never resolves a TOCI target (destination), so the tagged + // struct tree cannot emit a valid /Ref and the output is not a + // conformant table of contents (PDF/UA-2 clause 8.2.5.8.1). + // Re-enable once detection precision and target resolution are in + // place. (Remaining hardening is tracked in the internal tasks tracker.) + // new TableOfContentsProcessor().processTableOfContents(contents); ListProcessor.processLists(contents, false); }