Question
How can I test the Cloud OCR SDK processFields API method (or any other)?
Answer
You can use the ConsoleTest solution shipped with C# Code Sample
https://www.ocrsdk.com/documentation/quick-start-guide/csharp-ocr-library/
Step-by-step guide:
- Download .NET Code sample https://www.ocrsdk.com/documentation/code-samples/dotNet.zip Make sure you have Microsoft Visual Studio 2008 or later version with C# enabled. If you don’t have any, you can download and install Visual C# Express, it's free.
- Provide your Cloud OCR SDK credentials. For that please change Test.cs, class Test constructor
- Customize the URL for HTML requests. To do this open the General/GuiTest/app.config file and set the value tag of the ServerAddress setting according to the processing location. For example, for processing data in Europe, set the value as the following:
<setting name="ServerAddress" serializeAs="String">
<value>https://cloud-eu.ocrsdk.com</value> </setting> - Open the solution file Abbyy.CloudOcrSdk.sln in Visual Studio. Upgrade project if necessary.
- Set ConsoleTest as a StartUp project.
- Run the project
- Go dotNet\General\ConsoleTest\bin\Debug
- Type cmd inside File Path line, press Enter
- Type in ConsoleTest.exe and press Enter to see the available options/commands
- For processFields method use --asFields command. Make sure to preliminary create the XML file which will hold the processing settings(see example below). The description of XML tags is here https://www.ocrsdk.com/documentation/specifications/xml-scheme-field-settings/
Other mandatory operands for this command: the path to Input(source) file and the path to the Output directory.
Example of the XML file with processing settings()
<?xml version="1.0" encoding="utf-8"?>
<document xmlns="http://ocrsdk.com/schema/taskDescription-1.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocrsdk.com/schema/taskDescription-1.0.xsd
http://ocrsdk.com/schema/taskDescription-1.0.xsd">
<fieldTemplates>
<text id="numbers" bottom="0" left="0" right="0" top="0">
<language>Digits</language>
<textType>handprinted</textType>
<oneTextLine>true</oneTextLine>
</text>
<barcode bottom="0" id="cmc7">
<type>cmc7</type>
<containsBinaryData>true</containsBinaryData>
</barcode>
</fieldTemplates>
<page applyTo="0">
<text template="numbers" id="amount" left="900" top="220" right="1100" bottom="327" />
</page>
</document>
Related articles
https://support.abbyy.com/hc/en-us/articles/360017269520-processFields-Method
https://www.ocrsdk.com/documentation/specifications/xml-scheme-field-settings
Comments
0 comments
Please sign in to leave a comment.