This commit is contained in:
19
docs/snippets/elixir/getting-started/extract_with_ocr.md
Normal file
19
docs/snippets/elixir/getting-started/extract_with_ocr.md
Normal file
@@ -0,0 +1,19 @@
|
||||
```elixir title="Elixir"
|
||||
defmodule ExtractWithOcr do
|
||||
def extract_scanned_document do
|
||||
# Build configuration with OCR settings as JSON string
|
||||
config = ~s({"ocr": {"backend": "tesseract", "language": "eng"}})
|
||||
|
||||
case Kreuzberg.extract_file_sync("scanned.pdf", nil, config) do
|
||||
{:ok, result} ->
|
||||
IO.puts("Extracted via OCR:")
|
||||
IO.puts(result)
|
||||
:ok
|
||||
|
||||
{:error, reason} ->
|
||||
IO.puts("OCR extraction failed: #{reason}")
|
||||
:error
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
Reference in New Issue
Block a user