Skip to content

Commit 6a831ba

Browse files
committed
Release 20.5.0 & Minor fixes
1 parent fa1120d commit 6a831ba

20 files changed

+321
-18
lines changed

!DemoProject/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

!DemoProject/.idea/compiler.xml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

!DemoProject/.idea/jarRepositories.xml

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

!DemoProject/.idea/misc.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

!DemoProject/.idea/uiDesigner.xml

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

!DemoProject/.idea/vcs.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

!DemoProject/new_proj.iml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4" />

!DemoProject/pom.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>org.example</groupId>
7+
<artifactId>test_ocr_java</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
10+
<repositories>
11+
<repository>
12+
<id>AsposeJavaAPI</id>
13+
<name>Aspose Java API</name>
14+
<url>http://repository.aspose.cloud/repo</url>
15+
</repository>
16+
</repositories>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>com.aspose</groupId>
21+
<artifactId>aspose-ocr-cloud</artifactId>
22+
<version>20.5.0</version>
23+
<scope>compile</scope>
24+
</dependency>
25+
</dependencies>
26+
27+
</project>

!DemoProject/src/main/java/Main.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
import com.aspose.ocr.ApiClient;
3+
import com.aspose.storage.Configuration;
4+
import com.aspose.ocr.api.OCRResponse;
5+
import com.aspose.ocr.api.OcrApi;
6+
import okhttp3.ResponseBody;
7+
import retrofit2.Call;
8+
import retrofit2.Response;
9+
10+
import java.io.IOException;
11+
12+
import static java.lang.System.out;
13+
14+
15+
public class Main {
16+
// static {
17+
// Configuration.setAPI_KEY("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
18+
// Configuration.setAPP_SID("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
19+
// }
20+
21+
private static final String url = "https://upload.wikimedia.org/wikipedia/commons/2/2f/Book_of_Abraham_FirstPage.png";
22+
23+
public static String RecognizeFromUrl(String url) throws IOException {
24+
OcrApi api = new ApiClient().createService(OcrApi.class);
25+
Call<ResponseBody> call = api.RecognizeFromUrl(url);
26+
Response<ResponseBody> res = call.execute();
27+
OCRResponse ocrResp = OCRResponse.Deserialize(res.body());
28+
return ocrResp.text;
29+
}
30+
31+
public static void main(String[] args) {
32+
try {
33+
setUpConfig();
34+
String result = RecognizeFromUrl(url);
35+
out.println(result);
36+
} catch (IOException e) {
37+
e.printStackTrace();
38+
} catch (Exception e) {
39+
e.printStackTrace();
40+
}
41+
}
42+
43+
private static void setUpConfig() throws Exception {
44+
Configuration.setAPP_SID("148f05be-abe6-46e3-9182-f93375ec866f");
45+
Configuration.setAPI_KEY("b1dfcdbf9b602463cc9a03c50b5ae7b4");
46+
}
47+
}
48+
49+

0 commit comments

Comments
 (0)