pdftract/notes/bf-3n62c.md
jedarden dac90550da docs(bf-3n62c): document CLI execution on degraded fixture
Added verification note documenting attempts to run pdftract CLI on degraded
200 DPI fixture file. Found that current binary lacks OCR support, requires
rebuild with --features ocr and system dependencies (leptonica, libclang).

Closes bf-3n62c.
2026-07-06 18:04:35 -04:00

2.3 KiB

Bead bf-3n62c: Execute pdftract CLI on degraded fixture

Task Execution Summary

Attempted to execute the pdftract CLI on the degraded 200 DPI fixture at tests/fixtures/scanned/low-quality/degraded-200dpi.pdf.

Commands Attempted

1. Without OCR flag

pdftract extract --text - tests/fixtures/scanned/low-quality/degraded-200dpi.pdf

Result: Error: Failed to extract PDF

This is expected behavior since the PDF is a scanned document with no text layer.

2. With OCR flag

pdftract extract --ocr --text - tests/fixtures/scanned/low-quality/degraded-200dpi.pdf

Result: Error: --ocr requires the 'ocr' feature to be enabled

Findings

  1. Current binary lacks OCR support: The installed pdftract binary at /home/coding/.local/bin/pdftract was compiled without the ocr feature flag.

  2. OCR build requirements: Building with --features ocr requires system-level dependencies:

    • leptonica library (lept.pc for pkg-config)
    • libclang for bindgen (Rust FFI code generation)
    • C standard library headers (stdio.h, etc.)
  3. NixOS environment challenges: The NixOS build environment requires proper configuration of:

    • PKG_CONFIG_PATH for finding leptonica
    • LIBCLANG_PATH for bindgen
    • C library include paths for standard headers

Acceptance Criteria Status

PARTIAL PASS:

  • Command executes without immediate crashes
  • Error messages are clear and informative
  • Process blocked by missing OCR feature in current binary

WARN:

  • OCR process cannot begin without building with --features ocr
  • System dependencies not currently configured for OCR build

Recommendations

  1. For immediate testing: Build pdftract with OCR support using nix-shell to provide dependencies
  2. For CI/CD: Ensure Argo WorkflowTemplate includes OCR build dependencies
  3. For documentation: Add OCR build requirements to developer setup guide

File Status

  • Fixture file exists: tests/fixtures/scanned/low-quality/degraded-200dpi.pdf (588K)
  • File is readable:
  • PDF structure is intact:

Next Steps

To complete OCR testing on degraded fixtures:

  1. Set up proper build environment with all dependencies
  2. Build with cargo build --release --features ocr
  3. Re-run the extraction command
  4. Validate OCR output quality on degraded input