This commit is contained in:
26
docs/snippets/kotlin/config/pdf_hierarchy_config.md
Normal file
26
docs/snippets/kotlin/config/pdf_hierarchy_config.md
Normal file
@@ -0,0 +1,26 @@
|
||||
```kotlin title="Kotlin"
|
||||
import dev.kreuzberg.*
|
||||
import java.nio.file.Paths
|
||||
import java.util.Optional
|
||||
|
||||
fun main() {
|
||||
val hierarchy = HierarchyConfig.builder()
|
||||
.withEnabled(true)
|
||||
.withKClusters(5L)
|
||||
.withIncludeBbox(true)
|
||||
.withOcrCoverageThreshold(Optional.of(0.8f))
|
||||
.build()
|
||||
|
||||
val pdf = PdfConfig.builder()
|
||||
.withHierarchy(Optional.of(hierarchy))
|
||||
.build()
|
||||
|
||||
val config = ExtractionConfig.builder()
|
||||
.withPdfOptions(Optional.of(pdf))
|
||||
.build()
|
||||
|
||||
val result = Kreuzberg.extractFileSync(Paths.get("document.pdf"), null, config)
|
||||
val pages = result.pages().orEmpty()
|
||||
println("Pages: ${pages.size}")
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user