API�ĵ�

CamScanner OpenAPI for Android

Help Document

 

1.  Procedure to integrate CamScanner scan component-- OpenAPI

Îı¾¿ò: Step3: CamScanner provide the certified OpenAPI package to 3rd party appÎı¾¿ò: Step4: 3rd party integrates OpenAPI to their appÎı¾¿ò: Step2: CamScanner make the certificationÎı¾¿ò: Step1: 3rd party submit certification information

2. OpenAPI integration scheme and demo

2.1 OpenAPI integration scheme

Îı¾¿ò: Scanned image/pdfÎı¾¿ò: Source imageÎı¾¿ò: Image scan
processing
Îı¾¿ò: Scan component ¨COpenAPI










Îı¾¿ò: 3rd party app

2.2 Integration demo:

Îı¾¿ò: Scan Component OpenAPI

3.  Information required for certification

3rd party must submit following information to CamScanner:

Company name (Required):

Company description (optional):

Company website (Required):

3rd party App title and description (Required):

4.  OpenAPI content and prerequisite

After certification, CamScanner will provide SDK package for Android:

1.       Android OpenAPI:

Package includes:

1.       Scan component installation package (.apk), which is required to be installed on device for 3rd party app call scan component.

2.       Integration Guide: Interface definition and sample code.

 

Android SDK integration prerequisites:

Android OS��Android 2.x and above

Camera��Camera with Auto Focus and 2MP+

Image format:  *.jpg

 

5.  API Definition

5.1 Send image to scan

Intent Action ��com.intsig.camscanner.ACTION_SCAN

Request Parameters��

 

Type 

Requires

Description

Intent.EXTRA_STREAM

Uri

true

The Uri of source image

scanned_image

String

true

A path which 3rd party App provides to save the scanned  image

pdf

String

optional

A path which 3rd party App provides to save the pdf generated by CamScanner

org_image

String

optional

A path which 3rd party App provides to save the original image

EXAMPLE��

//

Intent intent = new Intent("com.intsig.camscanner.ACTION_SCAN");

Uri uri = Uri.fromFile(new File("/sdcard/source.jpg")); //Or  content uri picked from gallery

intent.putExtra(Intent.EXTRA_STREAM, uri);

intent.putExtra("scanned_image", ��/sdcard/scanned.jpg��);

intent.putExtra("pdf_path", ��/sdcard/processed.jpg��);

intent.putExtra("org_image", ��/sdcard/org.jpg��);

startActivityForResult(intent, REQUEST_CODE);

 

5.2 Get result

3rd party App can get the result in the function of onActivityResult(int requestCode, int resultCode, Intent data) in Activity. The returning values are following:

 

1.       resultCode

This value is following:

Activity.RESULT_OK: represents CamScanner has accepted your request and processed the image, and you can check the responseCode to decide whether CamScanner save the processed file in the specified path successfully;

Activity.RESULT_FIRST_USER: represents CamScanner has denied your request and will not return you the processed file. Please check responseCode for details.

Activity.RESULT_CANCELD: represents the user has canceled the scanning process.

 

2.       responseCode

This value is following:

6000: The returned result is ok.

4004: Invalid App package name. Please call CamScanner OpenAPI by startActivityForResult().

4006: The source image is invalid, such as the image file does not exist, broken, or not JPEG format.

5003: The 3rd party App certification is expired.

5006: The enhance mode which user choose is not authorized for the 3rd party App

5007: The request times has reached the limitation in one day.

7001: Can��t save the scanned image. The file is invalid, such as file not exists or no enough space to save the image.

7002: CamScanner can��t save the pdf document. The file is invalid, such as file not exists or no enough space to save the image.

7003: CamScanner can��t save the original image. The file is invalid, such as file not exists or no enough space to save the image.

 

EXAMPLE��

void  onActivityResult(int requestCode, int resultCode, Intent data){

If(requestCode == REQUEST_CODE ){

    int responseCode=data.getIntExtra(��RESPONSE_CODE��,-1);

If(resultCode==Activity.RESULT_OK){

//Success

}else if(resultCode == Activity.RESULT_FIREST_USER){

//Fail

}else if(resultCode==Activity.RESULT_CANCELED){

   // User canceled

}

}

}