Files
fil/docs/snippets/swift/ocr/ocr_elements.md

27 lines
511 B
Markdown
Raw Permalink Normal View History

2026-06-01 23:40:55 +02:00
```swift title="Swift"
import Foundation
import Kreuzberg
import RustBridge
let configJson = """
{
"ocr": {
"backend": "paddleocr",
"language": "en",
"element_config": {
"include_elements": true
}
}
}
"""
let config = try extractionConfigFromJson(configJson)
let result = try extractFileSync("scanned.pdf", nil, config)
if let elements = result.ocr_elements() {
for element in elements {
print("Text: \(element.text().toString())")
}
}
```