Spire.OCR for .NET

ニュース&リリース

2026-04-15

Spire.OCR 2.2.10 はクラウド AI モデルとの連携をサポートしました

Spire.OCR 2.2.10 をリリースいたしました。このバージョンでは、画像テキスト認識のためにクラウド AI モデル(Doubao、Qwen、DeepSeek など)との連携がサポートされました。(注:ユーザーは各 AI プラットフォームから独自の API キーを取得する必要があります。)詳細は以下の通りです。

変更内容一覧
カテゴリー ID 説明
新機能 SPIREOCR-125 画像テキスト認識のためにクラウド AI モデル(Doubao、Qwen、DeepSeek など)との連携をサポートしました。
static void Main(string[] args)
 {
     string filename = "1.png";
     string outputFile = "scan.txt";

     string filePath = "F:\\3.3.0AI\\AI\\"+"ocr.xml";
     string newModel = "AIModel";
     string newApiKey = "ApiKey";
     string newApiUrl = "ApiUrl";
     UpdateOcrConfig(filePath, newModel, newApiKey, newApiUrl);

     ScanImg(filename, outputFile);
 }
 public static void ScanImg(string filename, string outputFile)
 {
     OcrScanner scanner = new OcrScanner();
     ConfigureOptions configureOptions = new ConfigureOptions();
     configureOptions.ModelPath = "F:\\3.3.0AI\\AI";
     configureOptions.Language = "English";
     scanner.ConfigureDependencies(configureOptions);
     scanner.Scan(filename);
     File.WriteAllText(outputFile, scanner.Text.ToString());
 }
 public static void UpdateOcrConfig(string filePath, string model, string apiKey, string apiUrl)
 {
     XmlDocument doc = new XmlDocument();
     doc.Load(filePath);

     XmlNode modelNode = doc.SelectSingleNode("/ocr/configs/model");
     XmlNode apiKeyNode = doc.SelectSingleNode("/ocr/configs/apiKey");
     XmlNode apiUrlNode = doc.SelectSingleNode("/ocr/configs/apiUrl");

     if (modelNode != null) modelNode.InnerText = model;
     if (apiKeyNode != null) apiKeyNode.InnerText = apiKey;
     if (apiUrlNode != null) apiUrlNode.InnerText = apiUrl;

     doc.Save(filePath);
     Console.WriteLine("XML file updated!");
 }
Spire.OCR 2.2.10 のダウンロードはこちら: