Files
fil/docs/snippets/python/ocr/ocr_force_all_pages.md

18 lines
451 B
Markdown
Raw Normal View History

2026-06-01 23:40:55 +02:00
```python title="Python"
from kreuzberg import extract_file_sync, ExtractionConfig, OcrConfig
config: ExtractionConfig = ExtractionConfig(
ocr=OcrConfig(backend="tesseract"),
force_ocr=True,
)
result = extract_file_sync("document.pdf", config=config)
content: str = result.content
preview: str = content[:100]
total_length: int = len(content)
print(f"Extracted content (preview): {preview}")
print(f"Total characters: {total_length}")
```