1. Load the document (image or PDF).
2. Preprocess the image to improve OCR accuracy (deskew, denoise, threshold).
3. Perform OCR to extract text and structured data.
4. Optionally, extract tables from the document.
5. Format the output (text, Markdown, JSON, HTML, searchable PDF).
6. Return the extracted data and confidence scores.