Files
fil/docs/snippets/ruby/config/document_structure_config.md

16 lines
419 B
Markdown
Raw Normal View History

2026-06-01 23:40:55 +02:00
```ruby title="Document Structure Config (Ruby)"
require 'kreuzberg'
config = Kreuzberg::ExtractionConfig.new(include_document_structure: true)
result = Kreuzberg.extract_file_sync('document.pdf', config: config)
if result.document
result.document['nodes'].each do |node|
node_type = node['content']['node_type']
text = node['content']['text'] || ''
puts "[#{node_type}] #{text[0...80]}"
end
end
```