OCR and Barcode
The OCR module supports asynchronous export tasks and single-image text block extraction. The recognition module supports static barcode and QR detection.
Choose a Recognition Language
The upgraded CZOCR provides multilingual text recognition. Both text extraction and file export use params.language to select a language. See OCR Recognition Languages for all 89 currently available options and codes. Common values:
| Language | language |
|---|---|
| Simplified Chinese | ch |
| Traditional Chinese | chinese_cht |
| English | en |
| Japanese | japan |
| Korean | korean |
| French | fr |
| German | de |
| Spanish | es |
| Arabic | ar |
Specify the language explicitly when you know the document language. All input images in an OCR export task use one language; submit separate tasks for images in different languages.
Defaults and Parameter Compatibility
Omitting language or passing "auto" uses the current default Simplified Chinese (ch) model, not universal language detection. Pass one code string, not an array or display name. Replace languageType: "CHN_ENG" in older examples with language, and do not place the language inside nested params / ext_params extension objects. Invalid values return 1002 / InvalidParams; see OCR API.
OCR Export
{
"request_id": "req-ocr-001",
"method": "ocr.recognize",
"params": {
"input_upload_ids": ["img-..."],
"format": "docx",
"export_type": "multi-page",
"output_path": "/tmp/output.docx",
"language": "en"
}
}Supported formats: txt, pdf, docx, xlsx, ofd, and json. multi-page combines inputs into one file; single-page exports one file per image. Use output_path (multi-page file) or output_dir (single-page directory) to select an output location on the runtime host. When omitted, the SDK generates managed output paths. After completion, download results using data.task.assets[].download_url returned by ocr.get.
Query and cancel tasks:
{ "method": "ocr.get", "params": { "task_id": "ocr-..." } }
{ "method": "ocr.cancel", "params": { "task_id": "ocr-..." } }Text Block Extraction
{
"request_id": "req-extract-001",
"method": "ocr.extract_text",
"params": {
"input_upload_id": "img-...",
"language": "en"
}
}The response returns blocks[] with text, x, y, width, height, confidence, and font_size.
Barcode and QR Detection
{
"request_id": "req-barcode-001",
"method": "recognition.barcode_detect",
"params": {
"input_upload_id": "img-...",
"formats": ["QR_CODE", "CODE_128"]
}
}When formats is empty, the provider uses its default detection set. The response returns barcodes[] with format, text, and corner points.
INFO
Realtime barcode detection belongs to video/capture provider behavior and is not a public Command method. The realtime barcode sample data in the demo is UI-only and should not be called as an API.