This commit is contained in:
28
docs/snippets/go/config/ocr_dpi_config.md
Normal file
28
docs/snippets/go/config/ocr_dpi_config.md
Normal file
@@ -0,0 +1,28 @@
|
||||
```go title="Go"
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/kreuzberg-dev/kreuzberg/packages/go/v5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
targetDpi := int32(300)
|
||||
result, err := kreuzberg.ExtractFileSync("scanned.pdf", nil, kreuzberg.ExtractionConfig{
|
||||
Ocr: &kreuzberg.OcrConfig{
|
||||
Backend: "tesseract",
|
||||
TesseractConfig: &kreuzberg.TesseractConfig{
|
||||
Preprocessing: &kreuzberg.ImagePreprocessingConfig{
|
||||
TargetDpi: &targetDpi,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("extract failed: %v", err)
|
||||
}
|
||||
|
||||
log.Println("content length:", len(result.Content))
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user