This commit is contained in:
21
docs/snippets/rust/ocr/image_extraction.md
Normal file
21
docs/snippets/rust/ocr/image_extraction.md
Normal file
@@ -0,0 +1,21 @@
|
||||
```rust title="Rust"
|
||||
use kreuzberg::{extract_file_sync, ExtractionConfig, ImageExtractionConfig};
|
||||
|
||||
fn main() -> kreuzberg::Result<()> {
|
||||
let config = ExtractionConfig {
|
||||
images: Some(ImageExtractionConfig {
|
||||
extract_images: true,
|
||||
target_dpi: 200,
|
||||
max_image_dimension: 2048,
|
||||
inject_placeholders: true, // set to false to extract images without markdown references
|
||||
auto_adjust_dpi: true,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let result = extract_file_sync("document.pdf", None, &config)?;
|
||||
println!("content length: {}", result.content.len());
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user