Migrating from Kreuzberg v4
Xberg is the direct continuation of Kreuzberg. The Rust core and extraction API share the same lineage, but Xberg restarted package versioning at v1 under the new name. The Kreuzberg v4 line continues as a long-term-support release.
Backwards compatibility
Section titled “Backwards compatibility”- Existing v4 installs keep working. Kreuzberg v4 packages remain published under their original names and are supported as LTS (see below). Nothing you have deployed on v4 stops functioning.
- Go module pins keep resolving. Old imports of
github.com/kreuzberg-dev/kreuzbergcontinue to resolve from the Go module proxy cache. New v4 releases publish atgithub.com/kreuzberg-dev/kreuzberg-lts/v4; Xberg v1 isgithub.com/xberg-io/xberg/packages/go. - The v4 LTS line is MIT-licensed (earlier v4 shipped under Elastic License 2.0).
The v4 LTS line
Section titled “The v4 LTS line”Kreuzberg v4 is maintained at kreuzberg-dev/kreuzberg-lts with docs at kreuzberg.dev. It receives critical bug and security fixes until the end of 2026, on a best-effort basis. No new features land on v4 — feature work happens in Xberg.
Stay on v4 LTS if you depend on the R binding (not shipped by Xberg v1 — v4 is the last line to ship it) or you are not ready to migrate.
What changed in Xberg v1
Section titled “What changed in Xberg v1”Package names
Section titled “Package names”Package identifiers moved from kreuzberg to xberg:
| Ecosystem | v4 (Kreuzberg) | v1 (Xberg) |
|---|---|---|
| Rust (crates.io) | kreuzberg |
xberg |
| Python (PyPI) | kreuzberg |
xberg |
| npm | @kreuzberg/node, @kreuzberg/wasm |
@xberg-io/xberg, @xberg-io/xberg-wasm |
| Maven | dev.kreuzberg:kreuzberg |
io.xberg:xberg |
| NuGet | Kreuzberg |
XbergIo.Xberg |
| Packagist | kreuzberg/kreuzberg |
xberg-io/xberg |
| RubyGems | kreuzberg |
xberg |
| Hex (Elixir) | kreuzberg |
xberg |
| pub.dev (Dart) | — | xberg |
| Go module | github.com/kreuzberg-dev/kreuzberg |
github.com/xberg-io/xberg/packages/go |
| R binding | supported | removed (use v4 LTS) |
The standalone @kreuzberg/core npm package is gone — the Node package (@xberg-io/xberg) is
self-contained.
API identifiers
Section titled “API identifiers”Xberg standardizes extraction around an explicit input type and a result envelope:
- Replace
extract_fileandextract_byteswithextract(ExtractInput, config). - Replace legacy batch variants with
extract_batch(Vec<ExtractInput>, config). - Read extracted documents from
ExtractionResult.results; per-input failures are retained inExtractionResult.errorsinstead of discarding successful documents.
Generated bindings expose the same ExtractInput and ExtractionResult model with
language-appropriate async wrappers. Other identifiers that changed:
- Rust error type:
KreuzbergError→XbergError(andResult<T>now aliasesResult<T, XbergError>). - Config file discovery:
kreuzberg.{toml,yaml,json}→xberg.{toml,yaml,yml,json}(the.ymlextension is now also recognized).
Update the import/package name and see the API reference for your language.
Environment variables
Section titled “Environment variables”All environment variables are re-prefixed KREUZBERG_* → XBERG_* — for example
KREUZBERG_CACHE_DIR → XBERG_CACHE_DIR, KREUZBERG_OCR_BACKEND → XBERG_OCR_BACKEND,
KREUZBERG_OUTPUT_FORMAT → XBERG_OUTPUT_FORMAT. Rename any KREUZBERG_-prefixed variables in your
environment or deployment config.
- Removed:
KREUZBERG_PDFIUM_BUNDLED_PATH— the bundled PDFium fork was dropped. - New: Xberg adds
XBERG_-prefixed variables for layout tuning, OCR model tier/version, CoreML, and the ONNX Runtime execution provider. See the configuration reference for the full list.
Models and cache
Section titled “Models and cache”Downloaded models and the extraction cache move from the kreuzberg path segment to xberg
(e.g. ~/.cache/kreuzberg → ~/.cache/xberg), and model repositories are pulled from the
xberg-io Hugging Face org (was kreuzberg-dev). Existing caches are re-downloaded on first run.
Removed OCR backend
Section titled “Removed OCR backend”The Python/torch EasyOCR backend from Kreuzberg is removed. Xberg 1.1 adds Sceptre, a Rust implementation of the same CRAFT and Gen2 CRNN architecture, not a drop-in EasyOCR API replacement. You can also use Tesseract, PaddleOCR, the pure-Rust Candle backend, or a VLM backend.
OCR elements are opt-in
Section titled “OCR elements are opt-in”Kreuzberg v4 returned ocr_elements for OCR’d images without any setting. Xberg returns them only
when you ask for them. To get back the word elements v4 returned, set include_elements to true
and min_level to word in the OCR element configuration, and read ocr_elements from the first
result. With the default min_level, line, Tesseract returns line elements but leaves out word
elements; set min_level to word when you need each word’s coordinates.
Opt in to OCR elements to get each word’s text, bounding box and confidence
import asynciofrom xberg import extract, ExtractInput, ExtractInputKindfrom xberg._xberg import ExtractionConfig
async def main() -> None: input = ExtractInput(kind=ExtractInputKind("uri"), mime_type="image/png", uri="https://example.com/images/test_hello_world.png") config = ExtractionConfig.from_json("{\"force_ocr\":true,\"ocr\":{\"backend\":\"tesseract\",\"element_config\":{\"include_elements\":true,\"min_level\":\"word\"},\"enabled\":true,\"language\":[\"eng\"]}}") result = await extract(input, config) print(result.results[0].ocr_elements)
asyncio.run(main())Opt in to OCR elements to get each word’s text, bounding box and confidence
import { ExtractInput, ExtractInputKind, ExtractionConfig, OcrElementLevel, extract } from "@xberg-io/xberg";async function main() { const input: ExtractInput = { kind: ExtractInputKind.Uri, mimeType: "image/png", uri: "https://example.com/images/test_hello_world.png" }; const config: ExtractionConfig = { forceOcr: true, ocr: { backend: "tesseract", elementConfig: { includeElements: true, minLevel: OcrElementLevel.Word }, enabled: true, language: ["eng"] } }; const result = await extract(input, config); console.log(result.results?.[0]?.ocrElements);}
void main();Opt in to OCR elements to get each word’s text, bounding box and confidence
import { WasmExtractInput, WasmExtractInputKind, extract } from "@xberg-io/xberg-wasm";async function main() { const input: WasmExtractInput = (() => { const _u0 = WasmExtractInput.default(); _u0.kind = WasmExtractInputKind.Uri; _u0.mimeType = "image/png"; _u0.uri = "https://example.com/images/test_hello_world.png"; return _u0; })(); const result = await extract(input, { forceOcr: true, ocr: { backend: "tesseract", elementConfig: { includeElements: true, minLevel: "word" }, enabled: true, language: ["eng"] } }); console.log(result.results[0].ocrElements);}
void main();Opt in to OCR elements to get each word’s text, bounding box and confidence
use xberg::extract;use xberg::ExtractInput;
#[tokio::main]async fn main() { let input_json: serde_json::Value = serde_json::from_str(r#"{"kind":"uri","mime_type":"image/png","uri":"https://example.com/images/test_hello_world.png"}"#).unwrap(); let input = serde_json::from_value::<ExtractInput>(input_json).unwrap(); let config_json: serde_json::Value = serde_json::from_str(r#"{"force_ocr":true,"ocr":{"backend":"tesseract","element_config":{"include_elements":true,"min_level":"word"},"enabled":true,"language":["eng"]}}"#).unwrap(); let config = serde_json::from_value(config_json).unwrap(); let result = extract(input, &config).await.expect("call failed"); println!("{:?}", result.results[0].ocr_elements);}Opt in to OCR elements to get each word’s text, bounding box and confidence
package main
import ( "fmt" xberg "github.com/xberg-io/xberg/packages/go")
func ptr[T any](value T) *T { return &value }func main() { input := xberg.ExtractInput{ Kind: ptr(xberg.ExtractInputKindURI), URI: ptr(`https://example.com/images/test_hello_world.png`), MimeType: ptr(`image/png`), } config := xberg.ExtractionConfig{ Ocr: &xberg.OcrConfig{ Enabled: ptr(true), Backend: ptr(`tesseract`), Language: []string{`eng`}, ElementConfig: &xberg.OcrElementConfig{ IncludeElements: true, MinLevel: ptr(xberg.OcrElementLevelWord), }, }, ForceOcr: true, } result, err := xberg.Extract(input, config) if err != nil { panic(err) } fmt.Printf("%+v\n", result.Results[0].OcrElements)}Opt in to OCR elements to get each word’s text, bounding box and confidence
import io.xberg.*;
public final class Example { public static void main(String[] args) throws Exception { var inputJson = "{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}"; var input = JsonUtil.fromJson(inputJson, ExtractInput.class); var configJson = "{\"force_ocr\":true,\"ocr\":{\"backend\":\"tesseract\",\"element_config\":{\"include_elements\":true,\"min_level\":\"word\"},\"enabled\":true,\"language\":[\"eng\"]}}"; var config = JsonUtil.fromJson(configJson, ExtractionConfig.class); var result = Xberg.extract(input, config); System.out.println(result.results().get(0).ocrElements()); }}Opt in to OCR elements to get each word’s text, bounding box and confidence
import io.xberg.*import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
fun main() = kotlinx.coroutines.runBlocking { val mapper = jacksonObjectMapper().setPropertyNamingStrategy(com.fasterxml.jackson.databind.PropertyNamingStrategies.SNAKE_CASE) val input = mapper.readValue("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}", ExtractInput::class.java) val config = mapper.readValue("{\"force_ocr\":true,\"ocr\":{\"backend\":\"tesseract\",\"element_config\":{\"include_elements\":true,\"min_level\":\"word\"},\"enabled\":true,\"language\":[\"eng\"]},\"url\":{\"crawl\":{\"ssrf\":{}}}}", ExtractionConfig::class.java) val result = Xberg.extract(input, config) println(result.results.first().ocrElements)}Opt in to OCR elements to get each word’s text, bounding box and confidence
using System;using System.Text.Json;using Xberg;
var ConfigOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };var result = await XbergConverter.ExtractAsync(new ExtractInput { Kind = JsonSerializer.Deserialize<ExtractInputKind>("\"uri\"", ConfigOptions)!, MimeType = "image/png", Uri = "https://example.com/images/test_hello_world.png" }, new ExtractionConfig { ForceOcr = true, Ocr = new OcrConfig { Backend = "tesseract", ElementConfig = new OcrElementConfig { IncludeElements = true, MinLevel = JsonSerializer.Deserialize<OcrElementLevel>("\"word\"", ConfigOptions)! }, Enabled = true, Language = new List<string>() { "eng" } } });Console.WriteLine(result.Results[0].OcrElements);Opt in to OCR elements to get each word’s text, bounding box and confidence
import Xberg
let result = try await Xberg.extract("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}", "{\"force_ocr\":true,\"ocr\":{\"backend\":\"tesseract\",\"element_config\":{\"include_elements\":true,\"min_level\":\"word\"},\"enabled\":true,\"language\":[\"eng\"]}}")debugPrint(result.results()[0].ocrElements() as Any)Opt in to OCR elements to get each word’s text, bounding box and confidence
require "xberg"result = Xberg.extract(Xberg::ExtractInput.new(kind: 'uri', mime_type: 'image/png', uri: 'https://example.com/images/test_hello_world.png'), { 'force_ocr' => true, 'ocr' => { 'backend' => 'tesseract', 'element_config' => { 'include_elements' => true, 'min_level' => 'word' }, 'enabled' => true, 'language' => ['eng'] } })puts result.results[0].ocr_elements.inspectOpt in to OCR elements to get each word’s text, bounding box and confidence
<?php
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
use Xberg\Xberg;use Xberg\ExtractInput;$input = \Xberg\ExtractInput::from_json(json_encode(["kind" => "uri", "mimeType" => "image/png", "uri" => "https://example.com/images/test_hello_world.png"]));$result = Xberg::extract($input, ["force_ocr" => true, "ocr" => ["backend" => "tesseract", "element_config" => ["include_elements" => true, "min_level" => "word"], "enabled" => true, "language" => ["eng"]]]);var_dump($result->getResults()[0]->getOcrElements());Opt in to OCR elements to get each word’s text, bounding box and confidence
input_value = %Xberg.ExtractInput{kind: "uri", mime_type: "image/png", uri: "https://example.com/images/test_hello_world.png"}result = Xberg.extract_async(input_value, "{\"force_ocr\":true,\"ocr\":{\"backend\":\"tesseract\",\"element_config\":{\"include_elements\":true,\"min_level\":\"word\"},\"enabled\":true,\"language\":[\"eng\"]}}")IO.inspect(Enum.at(result.results, 0).ocr_elements)Opt in to OCR elements to get each word’s text, bounding box and confidence
import 'dart:io';import 'package:xberg/xberg.dart';import 'package:xberg/src/xberg_bridge_generated/frb_generated.dart' show RustLib;Future<void> main() async { await RustLib.init(); try { final input = await createExtractInputFromJson(json: '{"kind":"uri","mime_type":"image/png","uri":"https://example.com/images/test_hello_world.png"}'); final config = await createExtractionConfigFromJson(json: '{"force_ocr":true,"ocr":{"backend":"tesseract","element_config":{"include_elements":true,"min_level":"word"},"enabled":true,"language":["eng"]}}'); final result = await XbergBridge.extract(input, config: config); stdout.writeln(result.results[0].ocrElements); } finally { RustLib.dispose(); }}Opt in to OCR elements to get each word’s text, bounding box and confidence
const std = @import("std");const xberg = @import("xberg");
pub fn main() !void { const _result_json = try xberg.extract("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}", "{\"force_ocr\":true,\"ocr\":{\"backend\":\"tesseract\",\"element_config\":{\"include_elements\":true,\"min_level\":\"word\"},\"enabled\":true,\"language\":[\"eng\"]}}"); defer std.heap.c_allocator.free(_result_json); std.debug.print("{s}\n", .{_result_json});
}Opt in to OCR elements to get each word’s text, bounding box and confidence
#include <assert.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "xberg.h"
int main(void) { XBERGAlefHandle input_handle = xberg_extract_input_from_json("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}"); XBERGAlefHandle config_handle = xberg_extraction_config_from_json("{\"force_ocr\":true,\"ocr\":{\"backend\":\"tesseract\",\"element_config\":{\"include_elements\":true,\"min_level\":\"word\"},\"enabled\":true,\"language\":[\"eng\"]}}"); XBERGAlefHandle result = xberg_extract(input_handle, config_handle); xberg_extract_input_free(input_handle); xberg_extraction_config_free(config_handle); xberg_extraction_result_free(result); return EXIT_SUCCESS;}See OCR elements and word-level bounding boxes for every element field and filter.
PaddleOCR settings
Section titled “PaddleOCR settings”In Kreuzberg v4, the Node package took the PaddleOCR settings as a typed object with camelCase
fields. Xberg 1.3 and earlier took paddle_ocr_config as raw JSON. Every Xberg binding now also
exposes typed paddle_ocr_settings through PaddleOcrConfig, with the field names that the language
uses. A typed object has only the fields it declares, so the Node and TypeScript
paddleOcrSettings object ignores any other property, as every other typed config does. The legacy
paddle_ocr_config JSON field remains available, ignores unknown extension keys, and is deprecated
for removal in Xberg 2.0; typed settings take precedence when both are set.
Config files, JSON configs, and the REST and MCP request bodies keep the snake_case keys, such as
use_angle_cls and model_tier. In these, an unknown key in paddle_ocr_settings fails validation.
Configure PaddleOCR language, model tier, and model version
import asynciofrom xberg import extract, ExtractInput, ExtractInputKindfrom xberg._xberg import ExtractionConfig
async def main() -> None: input = ExtractInput(kind=ExtractInputKind("uri"), mime_type="image/png", uri="https://example.com/images/test_hello_world.png") config = ExtractionConfig.from_json("{\"ocr\":{\"backend\":\"paddleocr\",\"enabled\":true,\"language\":[\"en\"],\"paddle_ocr_settings\":{\"language\":\"en\",\"model_tier\":\"mobile\",\"model_version\":\"pp-ocrv6\"}}}") result = await extract(input, config) print(result.results[0].content)
asyncio.run(main())Configure PaddleOCR language, model tier, and model version
import { ExtractInput, ExtractInputKind, ExtractionConfig, extract } from "@xberg-io/xberg";async function main() { const input: ExtractInput = { kind: ExtractInputKind.Uri, mimeType: "image/png", uri: "https://example.com/images/test_hello_world.png" }; const config: ExtractionConfig = { ocr: { backend: "paddleocr", enabled: true, language: ["en"], paddleOcrSettings: { language: "en", modelTier: "mobile", modelVersion: "pp-ocrv6" } } }; const result = await extract(input, config); console.log(result.results?.[0]?.content);}
void main();Configure PaddleOCR language, model tier, and model version
import { WasmExtractInput, WasmExtractInputKind, extract } from "@xberg-io/xberg-wasm";async function main() { const input: WasmExtractInput = (() => { const _u0 = WasmExtractInput.default(); _u0.kind = WasmExtractInputKind.Uri; _u0.mimeType = "image/png"; _u0.uri = "https://example.com/images/test_hello_world.png"; return _u0; })(); const result = await extract(input, { ocr: { backend: "paddleocr", enabled: true, language: ["en"], paddleOcrSettings: { language: "en", modelTier: "mobile", modelVersion: "pp-ocrv6" } } }); console.log(result.results[0].content);}
void main();Configure PaddleOCR language, model tier, and model version
use xberg::extract;use xberg::ExtractInput;
#[tokio::main]async fn main() { let input_json: serde_json::Value = serde_json::from_str(r#"{"kind":"uri","mime_type":"image/png","uri":"https://example.com/images/test_hello_world.png"}"#).unwrap(); let input = serde_json::from_value::<ExtractInput>(input_json).unwrap(); let config_json: serde_json::Value = serde_json::from_str(r#"{"ocr":{"backend":"paddleocr","enabled":true,"language":["en"],"paddle_ocr_settings":{"language":"en","model_tier":"mobile","model_version":"pp-ocrv6"}}}"#).unwrap(); let config = serde_json::from_value(config_json).unwrap(); let result = extract(input, &config).await.expect("call failed"); println!("{:?}", result.results[0].content);}Configure PaddleOCR language, model tier, and model version
package main
import ( "fmt" xberg "github.com/xberg-io/xberg/packages/go")
func ptr[T any](value T) *T { return &value }func main() { input := xberg.ExtractInput{ Kind: ptr(xberg.ExtractInputKindURI), URI: ptr(`https://example.com/images/test_hello_world.png`), MimeType: ptr(`image/png`), } config := xberg.ExtractionConfig{ Ocr: &xberg.OcrConfig{ Enabled: ptr(true), Backend: ptr(`paddleocr`), Language: []string{`en`}, PaddleOcrSettings: &xberg.PaddleOcrConfig{ Language: ptr(`en`), ModelTier: ptr(`mobile`), ModelVersion: ptr(`pp-ocrv6`), }, }, } result, err := xberg.Extract(input, config) if err != nil { panic(err) } fmt.Printf("%+v\n", result.Results[0].Content)}Configure PaddleOCR language, model tier, and model version
import io.xberg.*;
public final class Example { public static void main(String[] args) throws Exception { var inputJson = "{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}"; var input = JsonUtil.fromJson(inputJson, ExtractInput.class); var configJson = "{\"ocr\":{\"backend\":\"paddleocr\",\"enabled\":true,\"language\":[\"en\"],\"paddle_ocr_settings\":{\"language\":\"en\",\"model_tier\":\"mobile\",\"model_version\":\"pp-ocrv6\"}}}"; var config = JsonUtil.fromJson(configJson, ExtractionConfig.class); var result = Xberg.extract(input, config); System.out.println(result.results().get(0).content()); }}Configure PaddleOCR language, model tier, and model version
import io.xberg.*import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
fun main() = kotlinx.coroutines.runBlocking { val mapper = jacksonObjectMapper().setPropertyNamingStrategy(com.fasterxml.jackson.databind.PropertyNamingStrategies.SNAKE_CASE) val input = mapper.readValue("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}", ExtractInput::class.java) val config = mapper.readValue("{\"ocr\":{\"backend\":\"paddleocr\",\"enabled\":true,\"language\":[\"en\"],\"paddle_ocr_settings\":{\"language\":\"en\",\"model_tier\":\"mobile\",\"model_version\":\"pp-ocrv6\"}},\"url\":{\"crawl\":{\"ssrf\":{}}}}", ExtractionConfig::class.java) val result = Xberg.extract(input, config) println(result.results.first().content)}Configure PaddleOCR language, model tier, and model version
using System;using System.Text.Json;using Xberg;
var ConfigOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };var result = await XbergConverter.ExtractAsync(new ExtractInput { Kind = JsonSerializer.Deserialize<ExtractInputKind>("\"uri\"", ConfigOptions)!, MimeType = "image/png", Uri = "https://example.com/images/test_hello_world.png" }, new ExtractionConfig { Ocr = new OcrConfig { Backend = "paddleocr", Enabled = true, Language = new List<string>() { "en" }, PaddleOcrSettings = new PaddleOcrConfig { Language = "en", ModelTier = "mobile", ModelVersion = "pp-ocrv6" } } });Console.WriteLine(result.Results[0].Content);Configure PaddleOCR language, model tier, and model version
import Xberg
let result = try await Xberg.extract("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}", "{\"ocr\":{\"backend\":\"paddleocr\",\"enabled\":true,\"language\":[\"en\"],\"paddle_ocr_settings\":{\"language\":\"en\",\"model_tier\":\"mobile\",\"model_version\":\"pp-ocrv6\"}}}")debugPrint(result.results()[0].content())Configure PaddleOCR language, model tier, and model version
require "xberg"result = Xberg.extract(Xberg::ExtractInput.new(kind: 'uri', mime_type: 'image/png', uri: 'https://example.com/images/test_hello_world.png'), { 'ocr' => { 'backend' => 'paddleocr', 'enabled' => true, 'language' => ['en'], 'paddle_ocr_settings' => { 'language' => 'en', 'model_tier' => 'mobile', 'model_version' => 'pp-ocrv6' } } })puts result.results[0].content.inspectConfigure PaddleOCR language, model tier, and model version
<?php
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
use Xberg\Xberg;use Xberg\ExtractInput;$input = \Xberg\ExtractInput::from_json(json_encode(["kind" => "uri", "mimeType" => "image/png", "uri" => "https://example.com/images/test_hello_world.png"]));$result = Xberg::extract($input, ["ocr" => ["backend" => "paddleocr", "enabled" => true, "language" => ["en"], "paddle_ocr_settings" => ["language" => "en", "model_tier" => "mobile", "model_version" => "pp-ocrv6"]]]);var_dump($result->getResults()[0]->content);Configure PaddleOCR language, model tier, and model version
input_value = %Xberg.ExtractInput{kind: "uri", mime_type: "image/png", uri: "https://example.com/images/test_hello_world.png"}result = Xberg.extract_async(input_value, "{\"ocr\":{\"backend\":\"paddleocr\",\"enabled\":true,\"language\":[\"en\"],\"paddle_ocr_settings\":{\"language\":\"en\",\"model_tier\":\"mobile\",\"model_version\":\"pp-ocrv6\"}}}")IO.inspect(Enum.at(result.results, 0).content)Configure PaddleOCR language, model tier, and model version
import 'dart:io';import 'package:xberg/xberg.dart';import 'package:xberg/src/xberg_bridge_generated/frb_generated.dart' show RustLib;Future<void> main() async { await RustLib.init(); try { final input = await createExtractInputFromJson(json: '{"kind":"uri","mime_type":"image/png","uri":"https://example.com/images/test_hello_world.png"}'); final config = await createExtractionConfigFromJson(json: '{"ocr":{"backend":"paddleocr","enabled":true,"language":["en"],"paddle_ocr_settings":{"language":"en","model_tier":"mobile","model_version":"pp-ocrv6"}}}'); final result = await XbergBridge.extract(input, config: config); stdout.writeln(result.results[0].content); } finally { RustLib.dispose(); }}Configure PaddleOCR language, model tier, and model version
const std = @import("std");const xberg = @import("xberg");
pub fn main() !void { const _result_json = try xberg.extract("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}", "{\"ocr\":{\"backend\":\"paddleocr\",\"enabled\":true,\"language\":[\"en\"],\"paddle_ocr_settings\":{\"language\":\"en\",\"model_tier\":\"mobile\",\"model_version\":\"pp-ocrv6\"}}}"); defer std.heap.c_allocator.free(_result_json); std.debug.print("{s}\n", .{_result_json});
}Configure PaddleOCR language, model tier, and model version
#include <assert.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "xberg.h"
int main(void) { XBERGAlefHandle input_handle = xberg_extract_input_from_json("{\"kind\":\"uri\",\"mime_type\":\"image/png\",\"uri\":\"https://example.com/images/test_hello_world.png\"}"); XBERGAlefHandle config_handle = xberg_extraction_config_from_json("{\"ocr\":{\"backend\":\"paddleocr\",\"enabled\":true,\"language\":[\"en\"],\"paddle_ocr_settings\":{\"language\":\"en\",\"model_tier\":\"mobile\",\"model_version\":\"pp-ocrv6\"}}}"); XBERGAlefHandle result = xberg_extract(input_handle, config_handle); xberg_extract_input_free(input_handle); xberg_extraction_config_free(config_handle); xberg_extraction_result_free(result); return EXIT_SUCCESS;}See the installation guide for the current package names.