This commit is contained in:
20
docs/snippets/rust/getting-started/extract_with_ocr.md
Normal file
20
docs/snippets/rust/getting-started/extract_with_ocr.md
Normal file
@@ -0,0 +1,20 @@
|
||||
```rust title="Rust"
|
||||
use kreuzberg::{extract_file_sync, ExtractionConfig, OcrConfig};
|
||||
|
||||
fn main() -> kreuzberg::Result<()> {
|
||||
let config = ExtractionConfig {
|
||||
force_ocr: true,
|
||||
ocr: Some(OcrConfig {
|
||||
backend: "tesseract".to_string(),
|
||||
language: "eng".to_string(),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let result = extract_file_sync("scanned.pdf", None, &config)?;
|
||||
println!("{}", result.content);
|
||||
println!("Detected languages: {:?}", result.detected_languages);
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user