Add invoice fixture with ground truth text for OCR testing. Files: - tests/fixtures/scanned/invoice/invoice-300dpi.pdf: 300 DPI scanned invoice - tests/fixtures/scanned/invoice/invoice-300dpi-ground-truth.txt: complete text content - tools/generate_invoice_pdf_fixtures.py: fixture generator script - tests/fixtures/PROVENANCE.md: added provenance entries for new fixtures - notes/bf-337i2.md: verification note Verification: - PDF is image-based (type=image, not text-embedded) - Resolution: 300 DPI (x-ppi=300, y-ppi=300) - Dimensions: 2550 x 3300 pixels (letter size at 300 DPI) - Ground truth contains complete invoice text with headers, addresses, line items, totals Closes bf-337i2
2 KiB
2 KiB
bf-337i2: Invoice OCR Fixture Creation
Task
Create a 300 DPI single-page invoice fixture with ground truth text.
Work Completed
1. Created Generator Script
- File:
tools/generate_invoice_pdf_fixtures.py - Creates invoice PDF from source image with proper 300 DPI metadata
- Uses img2pdf library to embed image with correct DPI settings
2. Generated Invoice Fixture
-
PDF:
tests/fixtures/scanned/invoice/invoice-300dpi.pdf- Image dimensions: 2550 x 3300 pixels
- DPI: 300 x 300 (verified with
pdfimages -list) - Physical size: 8.50 x 11.00 inches (letter size)
- Type: image (genuinely scanned, not text-embedded)
- Color: RGB, 8-bit, JPEG encoded
- File size: ~640KB
-
Ground Truth:
tests/fixtures/scanned/invoice/invoice-300dpi-ground-truth.txt- Contains complete invoice text content
- 36 lines including:
- Invoice header (number, date, due date)
- Sender/recipient addresses
- Line items (6 items with descriptions, quantities, unit prices, totals)
- Subtotal, shipping, tax, and grand total
- Payment terms
3. Verification
# Verified image type (not text-embedded)
pdfimages -list invoice-300dpi.pdf
# Output: type=image, x-ppi=300, y-ppi=300
# Verified PDF structure
pdfinfo invoice-300dpi.pdf
# Output: Page size: 612 x 792 pts (letter), 1 page
Acceptance Criteria
- ✅ invoice-300dpi.pdf exists in tests/fixtures/scanned/invoice/
- ✅ invoice-300dpi-ground-truth.txt exists with complete text content
- ✅ PDF is actual scanned content (verified: type=image)
- ✅ PDF is approximately 300 DPI (verified: x-ppi=300, y-ppi=300)
Tools Used
nix-shell -p python3Packages.img2pdf python3Packages.pillowpdfimages(for verification)pdfinfo(for verification)
Notes
The invoice document is a synthetic business invoice created for OCR testing. It contains realistic invoice structure (header, addresses, line items, totals) making it suitable for testing OCR accuracy on document layout and tabular data.