Files
fil/docs/snippets/kotlin/config/config_programmatic.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

33 lines
855 B
Markdown

```kotlin title="Kotlin"
import dev.kreuzberg.*
import java.nio.file.Paths
import java.util.Optional
fun main() {
val tesseract = TesseractConfig.builder()
.withPsm(6)
.build()
val ocr = OcrConfig.builder()
.withBackend("tesseract")
.withLanguage("eng+deu")
.withTesseractConfig(Optional.of(tesseract))
.build()
val chunking = ChunkingConfig.builder()
.withMaxCharacters(1000L)
.withOverlap(200L)
.build()
val config = ExtractionConfig.builder()
.withUseCache(true)
.withOcr(Optional.of(ocr))
.withChunking(Optional.of(chunking))
.withEnableQualityProcessing(true)
.build()
val result = Kreuzberg.extractFileSync(Paths.get("document.pdf"), null, config)
println("Content length: ${result.content().length}")
}
```