This commit is contained in:
28
docs/snippets/go/metadata/tables.md
Normal file
28
docs/snippets/go/metadata/tables.md
Normal file
@@ -0,0 +1,28 @@
|
||||
```go title="Go"
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/kreuzberg-dev/kreuzberg/packages/go/v5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
result, err := kreuzberg.ExtractFileSync("document.pdf", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("extract failed: %v", err)
|
||||
}
|
||||
|
||||
// Iterate over tables
|
||||
for _, table := range result.Tables {
|
||||
fmt.Printf("Table with %d rows\n", len(table.Cells))
|
||||
fmt.Println(table.Markdown) // Markdown representation
|
||||
|
||||
// Access cells
|
||||
for _, row := range table.Cells {
|
||||
fmt.Println(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user