ocr_file
Extract text from local image or PDF files using the OCR.space API, with support for multiple formats, languages, and output as text or JSON.
Instructions
Extract text from a local image or PDF file using OCR.space API. Supports PNG, JPG, GIF, BMP, TIFF, PDF. Free tier: max 1 MB. PRO tier: max 5 MB (EU endpoint for GDPR). Optionally saves result to txt or json file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tier | No | API tier: 'free' (1MB limit, US servers) or 'pro' (5MB limit, EU/GDPR) | free |
| scale | No | Upscale low-resolution images for better OCR | |
| is_table | No | Optimize for table-like structures | |
| language | No | OCR language code (e.g., 'eng', 'ger', 'fre'). Use 'auto' with Engine 2. | eng |
| file_path | Yes | Path to the image or PDF file to OCR | |
| ocr_engine | No | Engine 1: Faster, Asian languages. Engine 2: Auto-detect, better accuracy. | |
| output_path | No | Optional path to save extracted text (.txt) or full result (.json) | |
| output_format | No | Output format: 'txt' (text only) or 'json' (full API response) | txt |
| detect_orientation | No | Auto-rotate image based on detected text orientation | |
| is_overlay_required | No | Include word coordinates/bounding boxes in response | |
| is_create_searchable_pdf | No | Generate a searchable PDF (URL valid for 1 hour) |