Here’s a test case you can recreate: both parser runs report success and both contain Stop at 24.0 V. The second run puts that line on page 1 instead of page 2. Search still finds the voltage; the citation sends someone to the wrong page.

A whole-document text search would pass both runs. A better release check asks a smaller question: for a few facts you care about, did the parser keep the right text on the right physical page?

Start with two pages you can check by eye

Create a two-page test PDF. Insert a page break between these blocks, export once, then send the same file to both parser versions. The values here are synthetic. Use the PDF’s physical page positions, starting at 1, rather than the page number printed in a footer.

Physical page First line Second line
1 Service report SR-804 Inspection window: 14 days
2 Calibration record CAL-019 Stop at 24.0 V

Save each parser version, its options, and the SHA-256 of the input alongside the results. Write the expected phrases after looking at the PDF. The old output is useful for comparison, but it can already contain the bug.

Page 2 in the source PDF has the calibration limit, but the candidate puts it under page 1. Both candidate pages report Success.

Constructed failure for the test: the candidate puts the limit on page 1. This is an illustration, not a screenshot from a parser run.

Keep the page number when you adapt the output

If you're trying ComPDF AI Document Parsing as one of the parsers, the product page has a built-in Industrial Manual example. Here’s a short excerpt of its JSON, with other content blocks and fields omitted:

{ "result": { "pages": [ { "page_id": 1, "status": "Success", "content": [{"type": "paragraph_title", "text": "## Performance (according to ISO 9283)"}] } ] } } 

The page details reference documents the one-based page_id. Keep it when preparing the results. For another parser, adapt its output to the same shape or pass the check a dictionary of physical page numbers to text. Don’t infer page numbers after dropping empty pages: one missing page would then shift every citation after it.

Run the check before replacing the index

This check ignores whitespace changes such as a line wrap before V. It keeps case, punctuation, and units as written. If your application considers 24.00 V equivalent to 24.0 V, change that rule deliberately for this field. Avoid stripping punctuation throughout the document just to make a test pass.

Save the code as check_pages.py. python3 check_pages.py runs a passing case and then shows what happens when the value lands on the wrong page. For your own exports, use python3 check_pages.py old.json candidate.json if both use the schema above. For another schema, keep check() and replace the adapter for that parser.

import json import re import sys EXPECTED = { 1: ("Service report SR-804", "Inspection window: 14 days"), 2: ("Calibration record CAL-019", "Stop at 24.0 V"), } def page_text(response): pages = {} for page in response["result"]["pages"]: number = page["page_id"] if type(number) is not int or number < 1 or number in pages: raise ValueError(f"Invalid or duplicate page ID: {number!r}") if page["status"] != "Success": raise ValueError(f"Page {number}: status is {page['status']!r}") pages[number] = " ".join( block["text"] for block in page["content"] if isinstance(block.get("text"), str) ) return pages def check(pages, expected): failures = [] if pages.keys() != expected.keys(): missing = sorted(expected.keys() - pages.keys()) extra = sorted(pages.keys() - expected.keys()) failures.append(f"page IDs differ: missing={missing}, extra={extra}") for number, phrases in expected.items(): if number not in pages: continue text = " ".join(pages[number].split()) end = 0 for phrase in phrases: pattern = re.compile(r"(?<!\w)" + re.escape(phrase) + r"(?!\w)") hit = pattern.search(text, end) if not hit: reason = "out of order" if pattern.search(text) else "missing" failures.append(f"page {number}: {reason}: {phrase}") break # Inspect the first failed expectation on this page. end = hit.end() return failures def main(paths): if not paths: good = {number: "\n".join(phrases) for number, phrases in EXPECTED.items()} moved = {1: good[1] + "\nStop at 24.0 V", 2: "Calibration record CAL-019"} print("Whitespace only:", check({**good, 2: good[2].replace(" V", "\nV")}, EXPECTED) or "PASS") print("Moved line:", check(moved, EXPECTED) or "PASS") return 0 if len(paths) != 2: print("Usage: python3 check_pages.py [old.json candidate.json]", file=sys.stderr) return 2 failed = False for role, path in zip(("Baseline", "Candidate"), paths): try: with open(path, encoding="utf-8") as source: problems = check(page_text(json.load(source)), EXPECTED) except (OSError, KeyError, TypeError, ValueError) as error: problems = [f"Cannot check {path}: {error}"] print(f"{role}: {'REVIEW' if problems else 'PASS'}") for problem in problems: print(f" {problem}") failed |= bool(problems) return int(failed) if __name__ == "__main__": sys.exit(main(sys.argv[1:])) 

The no-file run should show Whitespace only: PASS and report that Stop at 24.0 V is missing on page 2. Both pages still exist. That's the regression that a document-wide search misses. If the original line is still on page 2 and a duplicate appears on page 1, the check passes. If a record must appear on only one page, add a separate check for that record’s unique ID; a voltage value alone may legitimately recur.

Before adding this to a release, try two more edits: remove page 2 entirely, then restore it and put the voltage line before the calibration record. You should see a missing page ID and an out-of-order phrase, respectively. For an intentionally blank page, keep its ID in the fixture and use an empty tuple of required phrases. With this adapter, it must still be returned with Success; the check does not certify that it is visually blank.

Decide what actually blocks the rollout

  • Candidate fails a source-checked rule: open the cited PDF page. Correct the parser configuration or the page mapping before rebuilding the index.
  • Both runs fail: look at the PDF before changing the expectation. They may share a bug, or the fixture may be wrong. Keep the rollout on hold while you check.
  • Both runs pass: this fixture is clear. It doesn't prove that tables, multi-column reading order, or every page in the archive survived. Add fixtures for those cases if your users rely on them.

Then follow one real search result through to the PDF viewer. Check that it opens the physical page with the cited sentence. The script checks exported page IDs and text; it can't tell whether your indexing code or viewer later dropped or shifted that ID.