Files
fil/docs/snippets/r/getting-started/extract_with_ocr.md

20 lines
430 B
Markdown
Raw Permalink Normal View History

2026-06-01 23:40:55 +02:00
```r title="R"
library(kreuzberg)
# Configure OCR settings via a plain list mirroring the config JSON.
config <- list(
force_ocr = TRUE,
ocr = list(
backend = "tesseract",
language = "eng"
)
)
# Extract an image file with OCR enabled
json <- extract_file_sync("image.png", "image/png", config)
result <- jsonlite::fromJSON(json, simplifyVector = FALSE)
cat("Extracted text from image:\n")
cat(result$content)
```