This commit is contained in:
17
docs/snippets/rust/config/document_structure_config.md
Normal file
17
docs/snippets/rust/config/document_structure_config.md
Normal file
@@ -0,0 +1,17 @@
|
||||
```rust title="Document Structure Config (Rust)"
|
||||
use kreuzberg::{extract_file_sync, ExtractionConfig};
|
||||
|
||||
let config = ExtractionConfig {
|
||||
include_document_structure: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let result = extract_file_sync("document.pdf", None, &config)?;
|
||||
|
||||
if let Some(document) = &result.document {
|
||||
for node in &document.nodes {
|
||||
let text = node.content.text().unwrap_or("");
|
||||
println!("[{}] {}", node.content.node_type_str(), &text[..text.len().min(80)]);
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user