Files
query-orchestration/docs/pdf-validation-requirements.md
T
Jay Brown 6dccf494f8 Merged in feature/permit-policy-cleanup (pull request #210)
cleanup permit policies and correct documentation

* docs

* policy cleanup

* refactor

* Merge remote-tracking branch 'origin/feature/permit-policy-cleanup' into feature/permit-policy-cleanup

* docs and edits
2026-02-19 20:22:59 +00:00

2.2 KiB

PDF Validation Requirements

Overview

Before documents are sent to AWS Textract for text extraction, the system performs several validation checks to ensure the PDF files meet Textract's requirements and can be processed successfully.

Validation Checks

1. File Type

Requirement: Only PDF files are accepted.

What we check: The file must have the MIME type application/pdf.

2. File Readability

Requirement: The PDF must be valid and readable.

What we check: The system attempts to open and parse the PDF file. Corrupted or malformed PDFs will be rejected.

3. File Size

Requirement: Each page must be 5 MB or smaller.

What we check: Every page in the PDF is validated individually. If any single page exceeds 5 MB, the document is rejected.

Why this matters: This is a requirement imposed by AWS Textract for synchronous processing.

4. Page Dimensions

Minimum: 50 x 50 pixels Maximum: 10,000 x 10,000 pixels

What we check: Each page's width and height must fall within this range.

Why this matters: Pages that are too small may not contain readable content. Pages that are too large exceed Textract's processing limits.

5. Image Resolution (DPI)

Minimum: 72 DPI (dots per inch)

What we check: Each page must have a resolution of at least 72 DPI for both width and height.

Why this matters: Low-resolution documents may not produce accurate text extraction results. Documents scanned or created at lower resolutions should be re-scanned or regenerated at a higher quality.

Validation Failure Reasons

When a document fails validation, the system records one of the following failure reasons:

  • invalid_mimetype - File is not a PDF
  • invalid_read - PDF is corrupted or cannot be opened
  • invalid_read_pages - One or more pages cannot be read
  • zero_page_count - PDF contains no pages
  • large_file - One or more pages exceeds 5 MB
  • small_dimensions - Page dimensions are too small (below 50x50 pixels)
  • large_dimensions - Page dimensions are too large (above 10,000x10,000 pixels)
  • small_dpi - Page resolution is below 72 DPI
  • large_dpi - Page resolution is too high (future use)