This commit is contained in:
25
docs/snippets/go/config/document_structure_config.md
Normal file
25
docs/snippets/go/config/document_structure_config.md
Normal file
@@ -0,0 +1,25 @@
|
||||
```go title="Document Structure Config (Go)"
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
kreuzberg "github.com/kreuzberg-dev/kreuzberg/packages/go/v5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config := kreuzberg.NewExtractionConfig(
|
||||
kreuzberg.WithIncludeDocumentStructure(true),
|
||||
)
|
||||
|
||||
result, err := kreuzberg.ExtractFileSync("document.pdf", config)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if result.Document != nil {
|
||||
for _, node := range result.Document.Nodes {
|
||||
fmt.Printf("[%s]\n", node.Content.NodeType)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user