0% found this document useful (0 votes)
14 views86 pages

Ephesoft Com Wiki Developers Guide

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 86

Log in / create account

page discussion view source history

Developers Guide
Contents [hide]
1 Ephesoft Script Guide
1.1 Batch Instance Group Feature
navigation 1.2 Force Review Feature
Wiki Home 1.3 ScriptAddNewTable.java
Ephesoft Home 1.4 ScriptAutomaticValidation.java
1.5 ScriptDocumentAssembler.java
download
1.6 ScriptExport.java
Community Edition
1.7 ScriptExtraction.java
documentation 1.8 ScriptFieldValueChange.java
Softw are 1.9 FunctionKey.java
Product Documentation 1.10 ScriptPageProcessing.java
How To 1.11 ScriptValidation.java
Admin Manual 2 Ephesoft Plugin Dev
User Manual 2.1 Creating Sample Plugin
Statistics 2.2 Advanced Implementation Steps
Developers Guide 2.3 Workflow Management
SDK JavaDoc 2.3.1 Introduction
support 2.3.2 XML Structure
Forums 2.3.3 Validation on above XML
Issue Tracking 2.3.4 Assumptions
3 Integrating External Applications with Ephesoft Validation
participate
3.1 How to use the External Application:
Forums
3.2 External Application and Security:
Feedback
3.3 Configuring the Title of External Applications through the admin UI
search 4 Scripting Changes in Version 2.5
5 JDOM Script Configuration
6 Netbeans IDE Setup
Go Search
7 Web Services API
toolbox 7.1 Authenticated client calls code sample
What links here 7.2 List of API’s exposed in Ephesoft Product
Related changes 7.2.1 Image Processing Web Service
Special pages 7.2.1.1 createSearchablePDF
Printable version 7.2.1.2 convertTiffToPdf
Permanent link 7.2.1.3 splitMultipageFile
7.2.1.4 createMultipageFile
7.2.2 Classification Web Service
7.2.2.1 classifyImage
7.2.2.2 classifyBarcodeImage
7.2.2.3 classifyHOCR

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
7.2.2.4 classifyMultiPageHOCR
7.2.3 Extraction Web Service
7.2.3.1 extractKV
7.2.3.2 extractFixedForm
7.2.3.3 extractFieldFromHocr
7.2.3.4 extractFuzzyDB
7.2.3.5 barcodeExtraction
7.2.3.6 regularRegexExtraction
7.2.3.7 commonAPIForExtraction
7.2.4 OCR Web Service
7.2.4.1 createOCR
7.2.5 Users and Groups Web Service
7.2.5.1 getBatchInstanceForRole
7.2.5.2 getBatchClassForRole:
7.2.6 Reporting Web Service
7.2.6.1 runReporting
7.2.7 Batch Instance Management Web Service
7.2.7.1 getBatchInstanceList
7.2.7.2 getAllModulesWorkflowNameByBatchClass
7.2.7.3 restartBatchInstance
7.2.7.4 deleteBatchInstance
7.2.7.5 restartAllBatchInstance
7.2.7.6 addUserRolesToBatchInstance
7.2.8 Batch Class Management Web Service
7.2.8.1 importBatchClass
7.2.8.2 exportBatchClass
7.2.8.3 getBatchClassList
7.2.8.4 getRoles
7.2.9 Uploading a Batch through a Web Service

Ephesoft Script Guide

Batch Instance Group Feature


This feature is used to provide the roles on the batch instance. If user role have an access to batch instance using batch instance group feature than that batch will display on the
BatchList screen. User will able to review/validate the same batch instance.
For this feature we are introduced the new database table “batch_instance_groups” for storing the batch instance identifier and user roles. This table stores all the mapped user roles
with the batch instances.
Database Structure:

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Method for assigning roles in batch instance group table:
public void assignedBatchInstanceGroup(String batchInstanceIdentifier, String userRole) throws DCMAException
Configurable parameters:

Example file: ScriptDocumentAssembler_BatchInstanceGroupFeature.java

Force Review Feature


The following is the implementation of the ForceReview feature:
1. A new tag is added to the batch.xml for any document level field by the name ForceReview. Assumption: This “ForceReview“ tag will come into play only if the
document containing it is invalid.
2. This tag is not mandatory. If it does not exist(or the value of it is not “true”) for a document level field, the functionality will work as earlier.
3. When this batch opens on the RV Screen, and this tag is found with a value “true” (for an invalid document):
1. Before the user saves the document once(by pressing CTRL+s/S or CTRL+q/Q) this field will appear RED(irrespective of REGEX validation).
2. Once the user presses CTRL+s/S or CTRL+q/Q on a certain field, we will make the value of the tag forceReview “False” for that field and the field will now get validated
according to the earlier functionality (REGEX validation).
It is expected that it will be the responsibility of the script to handle the setting of the ForceReview tag in sync with the document validity setting.
The ForceReview tag of a field will not make a document invalid. It will only prevent a document level field from getting validated(in a document in an invalid state) if
set to true.
This ForceReview tag won’t exist by default(before validation).
Provided is a sample script for the generation of this ForceReview tag(or modifying it if it is already present) with a value “true” for every alternate(note the i+=2 in the script) document
level field encountered in a batch.xml.
Example file: Force_Review_Feature_SampleScript.java

ScriptAddNewTable.java
The Add New Table script is useful for being able to generate a predefined table on the fly in the Validation view.
Example Scenario:
If you are processing invoice documents and have defined table extraction during the normal means, it is still possible that if the document is of poor image quality the table you have
defined for extraction may not be detected, or may be incomplete. In this case, you can use the Add New Table script to automatically generate a table for your invoice document type

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
with the click of a button. You could create a new empty table of your required structure, or even a populated one... using other extracted values from the documents fields to populate
the table values from a database table.
Example file: ScriptAddNewTable.java

ScriptAutomaticValidation.java
The Automatic Validation script is executed in the Ephesoft Batch Class work flow prior to reaching the Validation stage. This is the opportune time to implement any custom logic you
may require by running verification against the values that have been extracted for the fields defined.
Example Scenario:
You may wish you to retrieve the extracted value from one field, perhaps a Social Security Number, and use it to perform a look-up operation to an external database, retrieving an
associated name. You could then in turn us the results of these SQL query to populate the values of other document level fields defined in Ephesoft.
Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts
Example file: ScriptAutomaticValidation.java

ScriptDocumentAssembler.java
The Document Assembler script is executed in the Ephesoft Batch Class work flow following the Page Processing Module, and Prior to reaching the Document Review stage. At this
point the batch .xml has undergone Ephesoft's classification routines and the batch's contents are structured into documents, with confidence scores assigned. However, perhaps you
have a unique situation where the default Ephesoft classification behavior alone will not organize your batch's documents as your require. This script is the ideal location to implement
any logic to customize the classification organization of your batch. Although Document Level Fields are not yet present in the batch .xml at this point, page level fields are making
Script
Example Scenario:
You may be using cover sheets to aid in the classification accuracy for your documents. However by the time the work flow reaches the ScriptDocumentAssembler Ephesoft's
classification routines have already worked their magic and you may no longer have any use for the cover sheets. You can use this script to define some logic to remove the first page
of every document, which in this case would be the cover sheets.
We've provided as an example resource, a script that does exactly this: ScriptDocumentAssembler_remove-1st-page.java

ScriptExport.java
The Export script is executed in the Ephesoft Batch Class work flow during the processing of the Export Module. At this point all of Ephesoft's separation, classification, extraction, and
validation have been performed and the batch is in the process of leaving the Ephesoft system. Consequently, ScriptExport.java is the ideal place to implement logic facilitating custom
export requirements.
Example Scenario #1: As a batch is leaving the Ephesoft system, you may intend to import its .xml and image files into a document repository system. Your targeted system may
have its own internal XML schema for describing its contents, and to make the transition a seamless one you want to consider applying an XSLT translation to the Ephesoft batch .xml
so that it can be automatically imported and recognized by its destination system without manual effort.
Example Scenario #2: Perhaps you have a specific document management system such as FileBound in mind. FileBound uses Divider and Separator values to index its contents.
Ephesoft provides a FileBound Plugin in the Export Module. However, in addition to this you can implement logic in the ScriptExport.java file to populate the batch documents' divider
and separator fields based on a captured extraction value, barcode, or other means. Through Ephesoft scripting you could use an extracted barcode value as a look up key in a SQL
query to an external database table to retrieve the appropriate divider and separator values for a given document type.
Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts
Example file: ScriptExport.java

ScriptExtraction.java
The Extraction script, although similar in sequence position to the ScriptAutomaticValidation.java, is useful for the purpose of separating extraction from validation.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Example Scenario:
Assume you have some OMR field extraction defined to extract check boxes denoting credit card type. For example there could three boxes total, signifying a choice of visa, american
express, or mastercard. If filled out correctly the form should only have a check mark in one of the boxes. RecoStar OMR extraction will represent these three check boxes as a three
character string of binary values, with the box containing a mark being represented by a "1" value (the others, "0"). Your Extraction script function could analyze the binary values to
determine which of the three credit card vendors is being represented and set a document level field value to a string value of "visa", "amex", or "mastercard".
Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

ScriptFieldValueChange.java
The Field Value Change script can be toggled through the Ephesoft Validation Module, and when enabled will fire when the value of a field is changed in the user Validation View. This
can be extremely useful if you want to have the changes you make to one field automatically produce a change in value of one or more other fields.
Example Scenario #1:
Consider the case where you have a field that is of the drop down list type. This field contains a list of various departments within an organization (eg: HR, IT, etc). In addition to this
field you have another drop down field that serves as a list of users. You can use the Field Change script to implement logic such that change the department value for field #1 will
automatically update the drop down list of field #2 with users that correspond to that newly selected department.
Example Scenario #2:
Perhaps you have had a document arrive in Validation View with a loan number field that has been extracted, and some corresponding fields that contain information related to the loan
number. However, consider if the loan number is incorrect, and your user manually needs to change it. Instead of having to also manually look up and change all of the corresponding
fields, the Field Change Value script could make it so that changing the Loan Number field value automatically performs a look up operation to a database and populates the additional
fields with the information on file for that loan number.
Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts
Example file: ScriptFieldValueChange.java

FunctionKey.java
The Function Key script allows for multiple methods to be defined within the FunctionKey.java and have these individual methods bound to keys on the users keyboard to act as
keyboard shortcuts for executing pieces of custom functionality.
Example Scenario:
Consider that you may have a default set of values for a given document type that you want the option to populate its fields with in Validation View at the push of a button. In
FunctionKey.java you would implement a method to set the fields of that document type to a set of default values. In the Ephesoft Validation Module you can define the Function Key
that you want to associate with this method. You must specify both the name of the function as well as the key that you wish you bind it to. Having done so you should now see the
Function Key that you specified as an icon in the Validation View. The custom function key method can now be invoked by clicking this button or striking the specified key itself.
Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts
Example file: ScriptFunctionKey.java

ScriptPageProcessing.java
The Page Processing script is useful for conducting operations on the XML representation of a batch's pages before they have undergone classification and encapsulation into
documents.
Example Scenario:
To reduce batch processing time it is possible to use ScriptPageProcessing to remove pages that are 'garbarge' and don't contain valid OCR data. You could implement a function that
would iterate through the collection of pages, and from each page element retrieve the corresponding OCR file (.html) and image file name. If the OCR data for the page is nonexistent,
and the original image size is below a certain threshold you can deem the page to be junk and remove it from the batch .xml. By removing these useless pages your batch will be able
to traverse the rest of the batch class workflow more efficiently and with an improved processing time.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

ScriptValidation.java
The Validation script differs from the Automatic Validation script in that it is run during the user Validation User Interface experience, where as Automatic Validation executes and
performs custom validation steps immediately before the batch is presented to the user in the Validation UI. The benefit is this is that as the user is making changes to the document
field values in the Valdiation UI, the Validation Script can be triggered to run after each change to ensure that the changes are put through custom validation processing requirements.
Example Scenario:
You may have some a document level field, AccountNum, where the value being extracted should correspond to an existing account number in an external database. Perhaps due to
poor image quality, the OCR'd value for the account number is either incomplete or incorrect and so the document appears in Validation with its field highlighted in red. The user is able
to see the corresponding image and keys in what they believe to the the account number appearing on the image, but you want to ensure that they haven't made a mistake and what
they are inputting is indeed a valid account number. In this case it is possible to implement a function that takes the value of the AccountNum field and performs a database look up to
verify that the value does in fact exist. This check can run each time after the user has modified the AccountNum document field value and attempts to save their changes.
Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

Ephesoft Plugin Dev

Creating Sample Plugin


In order to create a new plugin, following steps need to be implemented:
Download the plugin code sample Download Now
1. Click on “File -> New -> Other…” option.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
2. Type “maven” and select “Maven project” from the list shown below.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
3. Check the “Create a simple project” option and click “Next”.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
4. Fill in the particulars for “Artifact” i.e. details about new project. These details include
1. “Group Id”: group id for the project as per maven artifacts standards
2. “Artifact Id”: artifact id, i.e. representation name for the plugin for use in various other projects.
3. “Version”: version of the plugin.
4. “Packaging”: type of packaging to be used for the project. In our application we use “jar” packaging.
After entering the above details for the new plugin, click on “Finish”.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
5. The structure shown below will be generated for the current project which includes the following:
1. “src” package: used for the storing the source code and resources used by the plugin.
2. “target” package: used for storing the target files i.e. the <b.“.class”</b> files, “.jar” files of the plugin.
3. “pom.xml” file: contains the information about the plugin.
Now start creating desired package structure for the project by right clicking on the “java” package and selecting the “new→others” option and selecting the
“package”.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
6. Type the hierarchical structure of the project and click on “Finish”.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
7. Above operation will create a package structure shown below.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
8. Create the desired files and corresponding folders for the plugin. Sample files can be found in the sample source code as well.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
9. Now that the plugin is ready with all the content, right click on the project name, go to “Run As” option and from the list shown choose “Maven Build”.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
10. A pop up window for editing the “Run/Debug” configuration will open up. In the “Goals” field, type “clean install”, check the “offline” and “Skip Tests” options and
then click “Apply”.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
11. For creating the jar file for the plugin following settings need to be taken care of:
1. Goto maven repository. Default path for the same is C:\Documents and Settings\{user-name}\.m2\repository folder.
2. Create the folder structure com\ephesoft\dcma\ephesoft\<VERSION_NUMBER> inside the repository folder.
3. Copy and paste the Ephesoft.jar inside the folder.
4. Rename Ephesoft.jar to Ephesoft-<Version_Number>.jar.
5. In the “pom.xml” file for the plugin make the following entry
<dependencies>
<dependency>
<groupId>com.ephesoft.dcma</groupId>
<artifactId>ephesoft</artifactId>
<version><VERSION_NUMBER></version>
</dependency>
</dependencies>

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
6. Now that we have defined the dependencies for the plugin, we can use the existing code contained within the “ephesoft-<VERSION_NUMBER>.jar” for the desired
purpose.

12. Click on “Run”, this will run the maven project and make its “jar”. A .jar file corresponding to the plugin will be created in the target folder for the same.

Advanced Implementation Steps


1. “Pre Processing” settings: In order to perform some desired work before running a plugin we can create a method in the plugin code file having “@PreProcess”
annotation.
2. “Post Processing” settings: In order to perform some desired work after running a plugin we can create a method in the plugin code file having “@PostProcess”
annotation.
3. We use the above settings in our application for creating a back up file for batch.xml before and after the plugin has processed which helps us defining the change a
plugin has made to the “batch.xml” files for the batch being processed.
4. Sample function for the above scenario:
@PreProcess
public void preProcess(final BatchInstanceID batchInstanceID, String ::pluginWorkflow) }
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Assert.notNull(batchInstanceID);
BackUpFileService.backUpBatch(batchInstanceID.getID());
}
@PostProcess
public void postProcess(final BatchInstanceID batchInstanceID, String pluginWorkflow) {
Assert.notNull(batchInstanceID);
BackUpFileService.backUpBatch(batchInstanceID.getID());
}
Use these settings in the new plugin in order to maintain consistency with the current conventions and workflow of the application.

5. BackUpFileService can be used to create backup xml files for the respective plugin.

Workflow Management
Introduction
• Establishments:
• A batch class is made of modules, which in turn consist of plugins.
• Dependencies between modules are only a result of the dependencies that exist between plugins.

Inference: By handling the dependencies that exist between plugins, we can create the Validation framework.

• Addition of a new tab in the admin view for workflow management by the name of “Workflow Management” containing the following:
• “Plugins List”: List of plugins already present.
• “Add New Plugin” button: For adding a new plugin.
• “Dependencies” button: On being clicked it will take user to a screen where it can manage the dependencies among the plugins.
• “Help” button: On being clicked the user will be shown a pop-up message containing the information about the new plugin upload.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
• “Add New plugin”: a plugin upload widget will open up. See the screenshot below
• “Browse”: a file selection window will open up.
• “Save”: this will save the plugin to the DB after validating the files.
• “Cancel”: this will cancel the operation.
• This widget will accept a .zip file for uploading.
• Contents of the zip file:
• .Jar file: The Jar for the plugin to be added.
• .Xml file: containing the plugin information.
• .Zip file must only contain these two files.
• .Zip file and .Jar file must have the same name.
• .Jar file content cannot be verified, so please make sure that they are as required.
• In order for this plugin to take effect, user needs to restart the tomcat server.
• Note:
• This Zip file after successful validation of its contents will be stored in the location specified in “<DCMA_HOME>\WEB-INF\classes\META-INF\application.properties” file
under the property named “plugin_upload_folder_path”.
• The JPDL file for the uploaded plugin will be stored at <Ephesoft-Shared-Folders\workflows\plugins\<PLUGIN_NAME> . This path is configurable in the dcma-
batch.properties file.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
XML Structure

<?xml version="1.0" encoding="UTF-8"?>


<plugin>
<jar-name></jar-name>
<plugin-name></plugin-name>
<plugin-desc></plugin-desc>
<plugin-workflow-name></plugin-workflow-name>
<plugin-service-instance></plugin-service-instance>
<method-name></method-name>
<is-scripting></is-scripting>
<back-up-file-name></back-up-file-name>
<script-name></script-name>
<application-context-path></application-context-path>
<plugin-properties>
<plugin-property>
<name></name>
<type></type>
<description></description>
<is-mandatory></is-mandatory>

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
<is-multivalue></is-multivalue>
<sample-values>
<sample-value></sample-value>
</sample-values>
</plugin-property>
</plugin-properties>
<dependencies>
<dependency>
<type-of-dependency></type-of-dependency>
<dependency-name></dependency-name>
</dependency>
</dependencies>
</plugin>

Validation on above XML


• All tags are compulsory and will have any string value, except for “is-scripting”,” is-mandatory” and “is-multivalue” tags which will have Boolean values (TRUE, FALSE).
• jar-name tag value must match the name of the jar file present in the zip file.
• If “is-scripting” tag has a value “TRUE”, only then the values of “back-up-file-name” and “script-name” tag will be taken into account.
• “plugin-property” and “dependency” tag can have multiple instances and have the values for plugin configs and dependencies respectively.

Assumptions
• “plugin-service-instance” and “method-name” tags must be correct as they cannot be validated. • “application-context-path” refers to the application context file name for the
plugin. • For the dependencies tag:
• For a new plugin, with dependencies as
o ORDER_BEFORE : P2,P3/P4,P5,P6/P7/P8
o UNIQUE : TRUE
o OR (/) operator and AND (,) operator are also supported for specifying complex dependencies.

<dependencies>
<dependency>
<type-of-dependency>ORDER_BEFORE </type-of-dependency>
<dependency-name>IMPORT_BATCH_FOLDER</dependency-name>
</dependency>
<dependency>
<type-of-dependency>ORDER_BEFORE </type-of-dependency>
<dependency-name>IMPORT_MULTIPAGE_FILES/CMIS_PLUGIN</dependency-name>
</dependency>
<dependency>
<type-of-dependency>ORDER_BEFORE </type-of-dependency>
<dependency-name>DOCUMENT_ASSEMBLER_PLUGIN,CLEAN_UP</dependency-name>

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
</dependency>

</dependencies>

Integrating External Applications with Ephesoft Validation


Ephesoft allows its customers to develop external modules or applications and integrate them to work together with Ephesoft. This section gives in depth details on how to integrate
external modules with Ephesoft's Validation module.
External modules/applications are technology independent and can be written in any language HTML/JavaScript or GWT or JSP/Servelt or combination of both.
Integrated application or module will be displayed in the Review Validation screen as Modal Window. The Right Hand shows the image of the documents where as Left Hand
shows the integrated application/module.
Review Validation Screen

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
There are shortcut keys as well as buttons defined to fire an External Application for a batch on the Review Validate UI. (App 1, App4, App2, App 3 as can be seen in the above UI)
When the shortcut key or the App button is pressed, the integrated application or module will be displayed in the Review Validation screen as Modal Window.
In the image below, the Right Hand side shows the image of the documents whereas the Left Hand side shows the integrated application/module.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
External Application

IMPORTANT: batch.xml must be updated by the external application. On the click of OK button, Ephesoft simply loads the updated batch.xml.

Follow below steps to for module integration:


1. Let's assume your application is available at http://localhost:8080/dcma/ExternalApp.html .
2. Login to the Ephesoft Admin Module (Batch Class Management).
3. Navigate to Batch Class -> Modules -> Validate Document module -> Validate Document plugin.
4. Assign URL of the application (http://localhost:8080/dcma/ExternalApp.html ) to one of the shortcuts, such as CTRL+8. It is possible to assign multiple applications to multiple

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
shortcuts as you can see below:

Closing the external application modal window:

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
As you can see in the screenshot of the External Application on the review-validate screen, there were two buttons present for closing the external application (earlier).
The OK button provided the functionality of refreshing and displaying refreshed content (on the review-validate screen) for the batch that has been modified through the external
application.
The CLOSE button simply goes back to the review-validate screen without refreshing the content of the batch, assuming that no changes have been made to the batch.xml by the
external application.
Now we have removed the extra click that the user has to do in case of refreshing the screen or closing the pop up dialog window.
Now both the functionalities (i.e. refreshing the screen after batch.xml updates or closing the pop up window without refreshing the Review Validate Screen) will be the implemented via
third party applications. We have provided a handle to the externally integrated applications by means of which they can communicate with the Ephesoft Application.
We have removed the ok and close buttons. External applications need to copy the below mentioned method in their code. They need to invoke this method on the respective button
(ok or close) calls which they have implemented. External applications will signal Ephesoft to perform respective operations by passing the appropriate operation string in the method
argument. Accepted operation strings are listed in the table below.
Method code for GWT based applications:
private native void fireEvent(String operation) /*-{
window.top.postMessage(operation,"*");
}-*/;
Method code for Javascript based applications:
function fireEvent(var operation) { window.top.postmessage(operation, “*”); }
The action performed by us in accordance to the argument passed to this method in the external application’s code:

Argument Passed by External


Result on our application
application
The dialog box containing the external application on the review-validate screen closes and the changes made in batch.xml get reflected on the
"Save"
screen(The functionality previously provided by the OK button on the dialog box)

The dialog box containing the external application on the review-validate screen closes, without refreshing the RV screen. (The functionality
"Cancel"
previously provided by the CLOSE button on the dialog box)
Any other string No Change (Dialog box will not disappear)

How to use the External Application:


It is expected that the external application would play around with the data contents of the documents (i.e. the batch) presently being displayed on the review validate screen. (For
which the external app is fired)
Hence we provide the external application the following two parameters appended in its URL, using which the external app can fetch/modify/delete the contents of the batch:
Path of the batch.xml for the current batch: The batch.xml contains the information regarding the batch. We provide the batch.xml path, which the ::external app can parse and
play around with as and when it likes.
The parameter is specified in the URL by: “batch_xml_path”
Encoding of Batch xml path parameter:
The batch xml path is encoded using java.net.URLEncoder and UTF-8 encoding.
Document Identifier: The identifier of the document in focus is also passed onto the external application. The parameter is specified in the URL by: “document_id”
Sample URL fired for an external app by Ephesoft:

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
{Ext. App URL}&document_id={Document Identifier}&batch_xml_path={Path of batch.xml}&ticket={Security Token}
Or
{Ext. App URL}?document_id={Document Identifier}&batch_xml_path={Path of batch.xml}&ticket={Security Token}

External Application and Security:


We are generating a dynamic token for every External Application window which is opened via Ephesoft Application. This token is sent to the External App by appending another
parameter "ticket" in the External App URL. Once this token is received by the External App, it can hit the below provided URL for checking the authenticity of the token.
http://{EphesoftServerIP}:{port}/dcma/authenticate?ticket={ticket}
Ephesoft Server in response will send a status code as to whether this ticket is valid or not:
Status Code 200 - Authorized
401 - Unauthorized
The token is issued as soon as the user opens the external application window. A valid token becomes invalid once:
Token has already been sent to the Ephesoft server for authentication.
One hour after this token has been issued.

Configuring the Title of External Applications through the admin UI


We have eliminated the Application URL from the title of External App Window. Title is now configurable through the Admin UI. We have eliminated the Application URL from the title of
External App Window. Title is now configurable through the Admin UI.

Scripting Changes in Version 2.5


Changes needed to be made to the scripts for making the old scripts work with the new ZIP functionality. For each script: Add the following import statements to the script java class
file:

import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileNotFoundException;

Add the following property after the import statements:


private static String ZIP_FILE_EXT = ".zip";
Replace the entire writeToXML method in each of the scripts with the following updated version:

private void writeToXML(Document document) {


String batchLocalPath = null;
NodeList batchLocalPathList = document.getElementsByTagName(BATCH_LOCAL_PATH);

if (null != batchLocalPathList) {
for (int index = 0; index < batchLocalPathList.getLength(); index++) {
Node batchLocalPathNode = batchLocalPathList.item(index);
batchLocalPath = batchLocalPathNode.getTextContent();
}
}

if (null == batchLocalPath) {
System.err.println("Unable to find the local folder path in batch xml file.");
return;
}

String batchInstanceID = null;

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
String batchInstanceID = null;
NodeList batchInstanceIDList = document.getElementsByTagName(BATCH_INSTANCE_ID);

if (null != batchInstanceIDList) {
for (int index = 0; index < batchInstanceIDList.getLength(); index++) {
Node batchInstanceIDNode = batchInstanceIDList.item(index);
batchInstanceID = batchInstanceIDNode.getTextContent();
}
}

if (null == batchInstanceID) {
System.err.println("Unable to find the batch instance ID in batch xml file.");
return;
}
String batchXMLPath = batchLocalPath.trim() + File.separator + batchInstanceID + File.separator + batchInstanceID
+ EXT_BATCH_XML_FILE;
String batchXMLZipPath = batchXMLPath + ZIP_FILE_EXT;
System.out.println("batchXMLZipPath************" + batchXMLZipPath);
Source source = new DOMSource(document);
File zipFile = new File(batchXMLZipPath);
OutputStream outputStream = null;
try {
if (zipFile.exists()) {
System.out.println("Found the batch xml zip file.");
outputStream = getOutputStreamFromZip(batchXMLPath, batchInstanceID + EXT_BATCH_XML_FILE);
} else {
System.out.println("Found the batch xml file.");
outputStream = new FileOutputStream(new File(batchXMLPath));
}
Result result = new StreamResult(outputStream);

Transformer xformer = null;


try {
xformer = TransformerFactory.newInstance().newTransformer();
} catch (TransformerConfigurationException e) {
System.err.println(e.getMessage());
} catch (TransformerFactoryConfigurationError e) {
System.err.println(e.getMessage());
}
try {
xformer.transform(source, result);
} catch (TransformerException e) {
System.err.println(e.getMessage());
}
} catch (IOException ioe) {
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
}
}
}
}

Add the following method to the script java class file, as it is required by the new writeToXml() function:

public static OutputStream getOutputStreamFromZip(final String zipName, final String fileName) throws FileNotFoundException, IOException {
ZipOutputStream stream = null;
stream = new ZipOutputStream(new FileOutputStream(new File(zipName + ZIP_FILE_EXT)));
ZipEntry zipEntry = new ZipEntry(fileName);
stream.putNextEntry(zipEntry);
return stream;
}

JDOM Script Configuration


Configuration for JDOM: Update the dcma-scripting-plugin.properties in {EPHESOFT_INSTALL_DIR}\WEB-INF\classes\META-INF\dcma-scripting-plugin
script.parser_type= jdom
If anything other than jdom is specified for script.parser_type then the dom parser will be used and Scripts using dom will be executed.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Sample Scripts for comparison DOM and JDOM: Let’s take the simple example for converting dom scripts into JDOM scripts.
1) Change the import statement
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
to
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
2) Change the implements statement :
IJDomScript is the interface for running the JDOM Scripts. Each scripts should implements IJDomScript for running the customize script using JDOM.
public class ScriptAutomaticValidation implements IScripts {
to
public class ScriptAutomaticValidation implements IJDomScript {
3) API difference in JDOM w.r.t DOM
Getting the list document object in JDOM is different from DOM: In JDOM we need to iterate each node for getting the child element list because JDOM doesn’t access the
child tag directly without accessing the parent tag of that child tag.
Getting Pages Nodes in JDOM vs. DOM
JDOM Case:
// Getting PAGES tag with accessing its parent in batch.xml
// Getting first child of root node
Element documents = document.getRootElement().getChild(DOCUMENTS);
// Getting first child of DOCUMENTS node
List documentList = documents.getChildren(DOCUMENT);
for (int documentIndex = 0; documentIndex < documentList.size(); documentIndex++) {
Element document = (Element) documentList.get(documentIndex);
Element pages = (Element) document.getChild(PAGES);
}
DOM Case:
// Getting directly PAGES tag without accessing its parent in batch.xml
NodeList documentList = document.getElementsByTagName(PAGES);
Getting Text Content from element:
JDOM Case:
String elementValue = element.getText();
DOM Case:
String elementValue = element.getTextContent();
Setting Text Context in element:
JDOM Case:
element.setText(“String Data”);

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
DOM Case:
element.setTextContent(“String Data”);

4) Used the following code for writing the XML using JDOM Scripts inside the Custom Script:
Call the following code for saving the XML e.g. writeToXML(document);
This code use the following method for saving the document.
/**
* The writeToXML method will write the state document to the XML file.
*
* @param document {@link Document}.
*/
private void writeToXML(Document document) {
String batchLocalPath = null;
List<?> batchLocalPathList = document.getRootElement().getChildren(BATCH_LOCAL_PATH);
if (null != batchLocalPathList) {
batchLocalPath = ((Element) batchLocalPathList.get(0)).getText();
}
if (null == batchLocalPath) {
System.err.println("Unable to find the local folder path in batch xml file.");
return;
}
String batchInstanceID = null;
List<?> batchInstanceIDList = document.getRootElement().getChildren(BATCH_INSTANCE_ID);
if (null != batchInstanceIDList) {
batchInstanceID = ((Element) batchInstanceIDList.get(0)).getText();
}
if (null == batchInstanceID) {
System.err.println("Unable to find the batch instance ID in batch xml file.");
return;
}
String batchXMLPath = batchLocalPath.trim() + File.separator + batchInstanceID + File.separator + batchInstanceID
+ EXT_BATCH_XML_FILE;
String batchXMLZipPath = batchXMLPath + ZIP_FILE_EXT;
System.out.println("batchXMLZipPath************" + batchXMLZipPath);
OutputStream outputStream = null;
File zipFile = new File(batchXMLZipPath);
FileWriter writer = null;
XMLOutputter out = new XMLOutputter();
try {
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
if (zipFile.exists()) {
System.out.println("Found the batch xml zip file.");
outputStream = getOutputStreamFromZip(batchXMLPath, batchInstanceID + EXT_BATCH_XML_FILE);
out.output(document, outputStream);
} else {
writer = new java.io.FileWriter(batchXMLPath);
out.output(document, writer);
writer.flush();
writer.close();
}
} catch (Exception e) {
System.err.println(e.getMessage());
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
}
}
}
}
For more reference please see the http://www.jdom.org/docs/faq.html

Netbeans IDE Setup


Download & install the latest version of the NetBeans IDE: http://netbeans.org/downloads/index.html
Launch Netbeans IDE

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Create a new Java Application Project:

To implement and build the Ephesoft scripting classes the Ephesoft.jar file must be added under the project dependencies.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Browse to the location of your Ephesoft installation’s library folder and locate Ephesoft.jar. The default path on the server machine is: C:\Ephesoft\Application\WEB-INF\lib

As a point of reference for Ephesoft script development you can examine the script files that are packaged with the default batch classes Ephesoft ships with.
C:\Ephesoft\SharedFolders\BC1\scripts
This screenshot depicts and implementation of the ScriptExtraction.java class file. However in this case a main() method has been added to allow for testing & debugging by
execution within the class.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
At this stage the main() method has been implemented to allow for the reading in of an Ephesoft batch .xml file, and passing that Document object to the ScriptExtraction execute()
method.

public static void main(String[] args)


{

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
{
try {
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build("BI10A_batch.xml");
ScriptExtraction extractor = new ScriptExtraction();
extractor.execute(doc, null, null);
} catch(Exception e) {
e.printStackTrace();
}
}

With the main() method in place it is now possible to execute the ScriptExtraction class. Successful execution is confirmed by the print statements in the NetBeans output section.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Web Services API

Authenticated client calls code sample

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Here is the code for making authenticated client calls via Ephesoft Web Services:-
Credentials defaultcreds = new UsernamePasswordCredentials("username", "password"); client.getState().setCredentials(new AuthScope("serverName", 8080), defaultcreds);
client.getParams().setAuthenticationPreemptive(true);

List of API’s exposed in Ephesoft Product


Image Processing Web Service

createSearchablePDF
This API will generate the searchable pdf. It takes the input tif/tiff files and rsp file for processing. Input parameters will used to specify the output pdf is searchable or color.
Web Service url: http://{serverName}:{port}/dcma/rest/createSearchablePDF

Input Parameter Values Descriptions


isColorImage Either “true”/”false” Generates the color pdf if input image is color and value is “true”.
isSearchableImage Either “true”/”false” Generates the searchable pdf if value is “true”.
outputPDFFileName String value should ends with .pdf extension Output pdf file name generated using API.
projectFile</span String value should ends with .rsp extension RSP file used as recostar processing.

Checklist:
i. Input only tiff, tif files for generating searchable pdf.
ii. RSP file is mandatory for generating the searchable pdf.

Sample Input Used:


create-searchable-pdf.zip

Sample client code using apache commons http client:-


private static void createSearchablePDF() {
HttpClient client = new HttpClient();
// URL for webservice of create searchable pdf
String url = "http://localhost:8080/dcma/rest/createSearchablePDF ";
PostMethod mPost = new PostMethod(url);

// adding file for sending


// Adding tif images for processing
File file1 = new File("C:\\sample\\sample1.tif");
File file2 = new File("C:\\sample\\sample2.tif");
File file3 = new File("C:\\sample\\sample3.tif");
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
File file3 = new File("C:\\sample\\sample3.tif");
File file4 = new File("C:\\sample\\sample4.tif");
// Adding rsp file for recostar for processing
File file5 = new File("C:\\sample\\Fpr.rsp");

Part[] parts = new Part[9];


try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
parts[2] = new FilePart(file3.getName(), file3);
parts[3] = new FilePart(file4.getName(), file4);
parts[4] = new FilePart(file5.getName(), file5);
// adding parameter for color switch
parts[5] = new StringPart("isColorImage", "false");
// adding parameter for searchable switch
parts[6] = new StringPart("isSearchableImage" , "true");
// adding parameter for outputPDFFileName
parts[7] = new StringPart("outputPDFFileName", "OutputPDF.pdf");
// adding parameter for projectFile
parts[8] = new StringPart("projectFile", "Fpr.rsp");

MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());


mPost.setRequestEntity(entity);

int statusCode = client.executeMethod(mPost);


if (statusCode == 200) {
InputStream inputStream = mPost.getResponseBodyAsStream();
// output file path for saving result
String outputFilePath = "C:\\sample\\serverOutput.zip";
// retrieving the searchable pdf file
File file = new File(outputFilePath);
FileOutputStream fileOutputStream = new FileOutputStream(file);
try {
byte[] buf = new byte[1024];
int len = inputStream.read(buf);
while (len > 0) {
fileOutputStream.write(buf, 0, len);
len = inputStream.read(buf);
}
} finally {
if (fileOutputStream != null) {

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
fileOutputStream.close();
}
}
System.out.println("Web service executed successfully.");
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

convertTiffToPdf

This API will generates the pdf for the input tiffs. If 5 input tiffs are provided then 5 pdf will return using this api. This API will have following parameter for configuration.
Web Service URL : http://{serverName}:{port}/dcma/rest/convertTiffToPdf

Input Parameter Values Descriptions


This value can be empty. Reference for image magick parameter. This are the image magick input parameters used for processing
inputParams
http://www.imagemagick.org/script/command-line-options.php the input and output file.
This value can be empty. Reference for image magick parameter. This are the image magick output parameters used for
outputParams
http://www.imagemagick.org/script/command-line-options.php optimizing the output file.
pdfGeneratorEngine Either “IMAGE_MAGICK”/”ITEXT” This will used for pdf generator engine.

Checklist:
i. Input only tiff, tif files for generating pdf.
ii. If pdfGeneratorEngine is “IMAGE_MAGICK”, than only input params and output params are works.
iii. If Input tiff is multipage tiff than single multipage pdf is generated as output.

Sample Input Used:

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
convert-tiff-to-pdf.zip

Sample client code using apache commons http client:-


private static void convertTiffToPdf() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/convertTiffToPdf ";
PostMethod mPost = new PostMethod(url);
// adding image file for processing.
File file1 = new File("C:\\sample\\sample1.tif");
File file2 = new File("C:\\sample\\sample2.tif");
Part[] parts = new Part[5];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
// adding parameter for input params
parts[2] = new StringPart("inputParams", "");
// adding parameter for output params
parts[3] = new StringPart("outputParams", "");
// adding parameter for pdfGeneratorEngine
parts[4] = new StringPart("pdfGeneratorEngine", "IMAGE_MAGICK");
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out</span.println("Web service executed successfully..");
InputStream in = mPost.getResponseBodyAsStream();
// output file path for saving results.
String outputFilePath = "C:\\sample\\serverOutput.zip";
// retrieving the searchable pdf file
File f = new File(outputFilePath);
FileOutputStream fos = new FileOutputStream(f);
try {
byte[] buf = new byte[1024];
int len = in.read(buf);
while (len > 0) {
fos.write(buf, 0, len);
len = in.read(buf);
}
} finally {
if (fos != null) {

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
fos.close();
}
}
} else if (statusCode == 403) {
System.out.println("Invalid username/password..");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

splitMultipageFile

This API will break the pdf and multipage tiff into single page tiff. This will used the image magick and ghost script for splitting the input file. This API will have following parameter for
configuration.
Web Service URL : http://{serverName}:{port}/dcma/rest/splitMultipageFile

Input
Values Descriptions
Parameter
For Image MagicK:
This value can be empty. Reference for image magick parameter. http://www.imagemagick.org/script/command-line- This parameter will used for both image magick
inputParams
options.php For Ghost Script: This value should not be empty. Reference for ghost script input parameter : and ghost script.
http://ghostscript.com/doc/8.54/Use.htm#Output_device

For Image MagicK:


outputParams This value can be empty. Reference for image magick parameter. http://www.imagemagick.org/script/command-line-
options.php || These are the image magick output parameters used for optimizing the output file.

This parameter is used to specify the weather


isGhostscript Either “true”/”false” ghost script is using for breaking the
pdf/multipage tiff into single page tiff.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Checklist
i. Input only tiff and pdf file only.
ii. If “isGhostscript” is “true”, than only input params will works and file only break PDF files.
iii. If “isGhostscript” is “false”, than input params and output params will works.

Sample Input Used:


split-multipage-file.zip

Sample client code using apache commons http client:-


private static void splitMultiPageFile() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/splitMultipageFile ";
PostMethod mPost = new PostMethod(url);
File file1 = new File("C:\\sample\\sample.pdf");
File file2 = new File("C:\\sample\\sample.tif");
Part[] parts =new Part[5];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
parts[2] = new StringPart("inputParams", "gswin32c.exe -dNOPAUSE -r300 -sDEVICE=tiff12nc -dBATCH");
parts[3] = new StringPart("isGhostscript", "true");
parts[4] = new StringPart("outputParams", "");
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
InputStream in = mPost.getResponseBodyAsStream();
File file = new File("C:\\sample\\serverOutput.zip");
FileOutputStream fos = new FileOutputStream(file);
try {
byte[] buf = new byte[1024];
int len = in.read(buf);
while (len > 0) {
fos.write(buf, 0, len);
len = in.read(buf);
}
} finally {
if (fos != null) {
fos.close();

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
}
}
System.out.println("Web service executed successfully..");
} else if (statusCode == 403) {
System.out.println("Invalid username/password..");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing..");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

createMultipageFile

This API will create the multipage tif/pdf using “Image MagicK”, “IText” and “GhostScript”. This API works only for tif/tiff files and provided XML file for input parameters. This API will
have following parameter for configuration
Web Service URL : http://{serverName}:{port}/dcma/rest/createMultiPageFile

Input Parameter Values Descriptions


This parameter is used for generating pdf using image_magick , itext and ghost
imageProcessingAPI Either “IMAGE_MAGICK” /”GHOSTSCRIPT”/”ITEXT”
script.
This value should not be empty. Reference for ghost script input
pdfOptimizationParams parameter : This are the ghost script output parameters used for optimizing the output file.
http://ghostscript.com/doc/8.54/Use.htm#Output_device

multipageTifSwitch Either “ON”/”OFF” This parameter is used for generating multipage tif along with multipage pdf.
pdfOptimizationSwitch Either “ON”/”OFF” This switch is used for generated optimized pdf.
This value should not be empty. Reference for ghost script input
ghostscriptPdfParameters parameter : This are the ghost script parameter used for creating multipage pdf.
http://ghostscript.com/doc/8.54/Use.htm#Output_device

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Checklist
i. Input only tiff file for processing and xml file for inputs.
ii. If “imageProcessingAPI” is “GHOSTSCRIPT”, than only ghostscriptPdfParameters will works.
iii. If “pdfOptimizationSwitch” is “ON”, than pdfOptimizationParams will works.

Sample Input Used:


create-multipage-file.zip

Format for XML:


<WebServiceParams>
<Params>
<Param>
<Name>imageProcessingAPI</Name>
<Value>GHOSTSCRIPT</Value>
</Param>
<Param>
<Name>pdfOptimizationSwitch</Name>
<Value>on</Value>
</Param>
<Param>
<Name>pdfOptimizationParams</Name>
<Value>-q -dNODISPLAY -P- -dSAFER -dDELAYSAFER -- pdfopt.ps</Value>
</Param>
<Param>
<Name>multipageTifSwitch</Name>
<Value>on</Value>
</Param>
<Param>
<Name>ghostscriptPdfParameters</Name>
<Value>-dQUIET -dNOPAUSE -r300 -sDEVICE=pdfwrite -dBATCH</Value>
</Param>
</Params>
</WebServiceParams>

Sample client code using apache commons http client:-


private static void createMultiPage() {
HttpClient client = new HttpClient();

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
String url = "http://localhost:8080/dcma/rest/createMultiPageFile ";
PostMethod mPost = new PostMethod(url);
// Adding XML file for parameters
File file1 = new File("C:\\sample\\WebServiceParams.xml");
// Adding tif file for processing
File file2 = new File("C:\\sample\\sample1.tif");
File file3 = new File("C:\\sample\\sample2.tif");
Part[] parts = new Part[3];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
parts[2] = new FilePart(file3.getName(), file3);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
InputStream inputStream = mPost.getResponseBodyAsStream();
// Retrieving file from result
File file = new File("C:\\sample\\serverOutput.zip");
FileOutputStream fos = new FileOutputStream(file);
try {
byte[] buf = new byte[1024];
int len = inputStream.read(buf);
while (len > 0) {
fos.write(buf, 0, len);
len = inputStream.read(buf);
}
} finally {
if (fos != null) {
fos.close();
}
}
System.out.println("Web service executed successfully..");
} else if (statusCode == 403) {
System.out.println("Invalid username/password..");
} else {
System.out.println(statusCode + " *** " + mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing..");

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

Classification Web Service

classifyImage

This API classify the input image as per batch class identifier provided. This API will depend on the three plugin for completion “CREATE_THUMBNAILS_PLUGIN”,
“CLASSIFY_IMAGES_PLUGIN” and “DOCUMENT_ASSEMBLER_PLUGIN”. If any batch class doesn’t have those plugin than classify image api will not work.
Web Service URL : http://{serverName}:{port}/dcma/rest/classifyImage

Input
Values Descriptions
Parameter
This value should not be empty and it should be batch class identifier as This parameter is used for providing batch class identifier on which classify image will
batchClassId
like BC1. perform..

Sample Input Used:


classify-image.zip

Checklist:
i. Input file should be single page tif/tiff file only.
ii. batchClassId should be valid batch class identifier and must have the “CREATE_THUMBNAILS_PLUGIN”, “CLASSIFY_IMAGES_PLUGIN” and
“DOCUMENT_ASSEMBLER_PLUGIN”.

Sample client code using apache commons http client:-


private static void classifyImage() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/classifyImage ";
PostMethod mPost = new PostMethod(url);
// Adding tif file for processing
File file1 = new File("C:\\sample\\US-Invoice.tif");
Part[] parts = new Part[2];
try {
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
parts[0] = new FilePart(file1.getName(), file1);
// Adding parameter for batchClassId
parts[1] = new StringPart("batchClassId", "BC1");
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Web service executed successfully..");
String responseBody = mPost.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password..");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing..");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if(mPost != null) {
mPost.releaseConnection();
}
}
}

classifyBarcodeImage

This API is used to classify the input image as per specified batch class. Image file should have barcode and barcode value should be document type which is present in the batch
class.
Web Service URL: http://{serverName}:{port}/dcma/rest/classifyBarcodeImage

Input
Values Descriptions
Parameter
This value should not be empty and it should be batch class identifier as This parameter is used for providing batch class identifier on which classify HOCR will
batchClassId
like BC1 perform.

Checklist:

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
i. Input file should be tif/tiff file only.
ii. batchClassId should be valid batch class identifier and must have the “BARCODE_READER_PLUGIN” .

Sample client code using apache commons http client:-


private static void classifyBarcodeImage(){
HttpClient client = new HttpClient();
String url = "http://locahost:8080/dcma/rest/classifyBarcodeImage ";
PostMethod mPost = new PostMethod(url);
// Adding image file for processing the barcode classification
File file1 = new File("C:\\sample\\US-Invoice.tif");
Part[] parts = new Part[2];
try {
parts[0] = new FilePart(file1.getName(), file1);
// Adding batchClassId for which barcode classification to be perform.
parts[1] = new StringPart("batchClassId", "BC1");
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Web service executed successfully..");
String responseBody = mPost.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password..");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing..");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
}

classifyHOCR

This API will classify the input HOCR as per batch class identifier provided. This API will depend on the following plugins “SEARCH_CLASSIFICATION_PLUGIN”,
“DOCUMENT_ASSEMBLER_PLUGIN” and the learning done on the batch class. If any batch class doesn’t have those plugins than classify hocr will not work.
Web Service URL : http://{serverName}:{port}/dcma/rest/classifyHOCR

Input
Values Descriptions
Parameter
This value should not be empty and it should be batch class identifier as This parameter is used for providing batch class identifier on which classify HOCR will
batchClassId
like BC1. perform.

Checklist
i. Input file should be html file only.
ii. batchClassId should be valid batch class identifier and must have the “SEARCH_CLASSIFICATION_PLUGIN” and “DOCUMENT_ASSEMBLER_PLUGIN”.

Sample Input Used:


classify-hocr.zip

Sample client code using apache commons http client:-


private static void classifyHocr() {
int PORT = 8080;
String SERVER_NAME = "localhost";
String USERNAME = "ephesoft";
String PASSWORD = "demo";
String HTTP = "http://";
String DCMA_REST_PATH = "/dcma/rest";
String COLON = ":";
String BATCH_CLASS_ID_PARAM = "batchClassId";
String batchClassId = "BC1";
String hocrFilePath = "C:\\WS\\Application-Checklist_000_HOCR.xml";
HttpClient client = new HttpClient();
Credentials defaultcreds = new UsernamePasswordCredentials(USERNAME, PASSWORD);
client.getState().setCredentials(new AuthScope(SERVER_NAME, PORT), defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
String webServiceUrl = HTTP + SERVER_NAME + COLON + PORT + DCMA_REST_PATH + "/classifyHocr";
PostMethod mPost = new PostMethod(webServiceUrl);
// Adding XML file for processing
File hocrXmlFile = new File(hocrFilePath);
Part[] parts = new Part[2];

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
try {
parts[0] = new FilePart(hocrXmlFile.getName(), hocrXmlFile);
// Adding parameter for batchClassId
parts[1] = new StringPart(BATCH_CLASS_ID_PARAM, batchClassId);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int responseCode = client.executeMethod(mPost);
if (responseCode == 200) {
System.out.println("Web service executed successfully..");
String responseBody = mPost.getResponseBodyAsString();
System.out.println(responseCode + " *** " + responseBody);
} else if (responseCode == 403) {
System.out.println("Invalid username/password..");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing..");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

classifyMultiPageHOCR

This API will classify the input HOCR as per batch class identifier provided. This API will depend on the following plugins “SEARCH_CLASSIFICATION_PLUGIN”,
“DOCUMENT_ASSEMBLER_PLUGIN” and the learning done on the batch class. Both the mentioned plugins should be present and also should be ON. If any batch class doesn’t have
those plugins then classify hocr will not work.

Web Service URL : http://{serverName}:{port}/dcma/rest/classifyMultiPageHocr

Input
Values Descriptions
Parameter

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
This value should not be empty and it should be batch class identifier as This parameter is used for providing batch class identifier on which classify HOCR will
batchClassId
like BC1. perform.

Checklist:
i. Input file should be zip file containing HOCR.xml’s in it.
ii. batchClassId should be valid batch class identifier and must have the “SEARCH_CLASSIFICATION_PLUGIN” and “DOCUMENT_ASSEMBLER_PLUGIN”.

Sample client code using apache commons http client:-


private static void classifyMultiPageHocr() {
int PORT = 8080;
String SERVER_NAME = "localhost";
String USERNAME = "ephesoft";
String PASSWORD = "demo";
String HTTP = "http://";
String DCMA_REST_PATH = "/dcma/rest";
String COLON = ":";
String BATCH_CLASS_ID_PARAM = "batchClassId";
String batchClassId = "BC6";
String CLASSIFY_MULTI_PAGE_HOCR_WS = "/classifyMultiPageHocr";
String zipFilePath = "C:\\WS\\hocr_files.zip";
HttpClient client = new HttpClient();
Credentials defaultcreds = new UsernamePasswordCredentials(USERNAME, PASSWORD);
client.getState().setCredentials(new AuthScope(SERVER_NAME, PORT), defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
String webServiceUrl = HTTP + SERVER_NAME + COLON + PORT + DCMA_REST_PATH + CLASSIFY_MULTI_PAGE_HOCR_WS;
PostMethod mPost = new PostMethod(webServiceUrl);
// Adding ZIP file for processing
File zipFile = new File(zipFilePath);
Part[] parts = new Part[2];
try {
parts[0] = new FilePart(zipFile.getName(), zipFile);
// Adding parameter for batchClassId
parts[1] = new StringPart(BATCH_CLASS_ID_PARAM, batchClassId);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int responseCode = client.executeMethod(mPost);
if (responseCode == 200) {
System.out.println("Web service executed successfully..");
String responseBody = mPost.getResponseBodyAsString();
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
System.out.println(responseCode + " *** " + responseBody);
} else if (responseCode == 403) {
System.out.println("Invalid username/password..");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

Extraction Web Service

extractKV

This API will extract the document level fields for the corresponding Key Value pattern provided using input XML. This API will take the HOCR xml file as a input. If the Key Value
pattern not found in the HOCR file then it will create empty document level fields. Web Service URL : http://{serverName}:{port}/dcma/rest/extractKV
Batch Class List >>Recostar Mail Room [BC1] >>Application-Checklist >>Invoice Date >>New KV Extraction

Input
Values Descriptions
Parameter
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
AdvancedKV Either “true”/”false” This parameter is used to specifying the KeyValue extraction is perform by advanced key value or not.
This value should be one of the following:
LocationType TOP, RIGHT, LEFT, BOTTOM, TOP_RIGHT, This parameter will fetch the Value pattern of the particular key pattern on the location provided
TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT

This parameter is used for specify in case of AdvancedKV is false. This parameter is used for adding number
NoOfWords Should be Integer
word of RIGHT location in the result of the value pattern found in the HOCR file.
This value should not be empty.
KeyPattern This is used to verify the Key pattern present in given HOCR
This value should be valid regex expression.

This value should not be empty.


ValuePattern This is used for verify the Value pattern present in given HOCR for that particular Key Pattern
This value should be valid regex expression

This value should be one of the following:


KVFetchValue This parameter is used to specify the whether we need fetch all, first or last value pattern found.
ALL, FIRST, LAST

This value should be float and should be in between 0 This value is used to multiply with confidence for updating the confidence of the fields extracted using
Multiplier
to 1 advanced KV.
Length This value should be integer For getting length value use Ephesoft Admin Screen as display screen shot above
Width This value should be integer For getting width value use Ephesoft Admin Screen as display screen shot above
Xoffset This value should be integer For getting xoffset value use Ephesoft Admin Screen as display screen shot above
Yoffset This value should be integer For getting yoffset value use Ephesoft Admin Screen as display screen shot above

CheckList:
i. For using Advance KV user should have admin access to fetch the accurate value of Length, Width, Xoffset and Yoffset. Before using AdvancedKV, please test the image
with Ephesoft Admin Screen and note the values of Length, Width, Xoffset, Yoffset and LocationType for the particular KeyValue pattern.
ii. If AdvancedKV is true than NoOfWords is not use and all other parameters is used.
iii. If AdvancedKV is false than NoOfWords, KeyPattern, ValuePattern and LocationType will work.

Sample Input Used:


extract-kv.zip

Format for XML:


<ExtractKVParams>
<Params>
<AdvancedKV>true</AdvancedKV>
<LocationType>BOTTOM_LEFT</LocationType>
<NoOfWords>0</NoOfWords>
<KeyPattern>APPLICATION</KeyPattern>
<ValuePattern>[a-zA-Z]{10,15}</ValuePattern>
<KVFetchValue>ALL</KVFetchValue>
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
<Multiplier>1</Multiplier>
<Length>384</Length>
<Width>251</Width>
<Xoffset>284</Xoffset>
<Yoffset>105</Yoffset>
</Params>
</ExtractKVParams>

Sample client code using apache commons http client:-


private static void extractKV() {
String SERVER_NAME = "localhost";
int PORT = 8080;
String USERNAME = "ephesoft";
String PASSWORD = "demo";
String COLON = ":";
String HTTP = "http://";
String DCMA_REST_PATH = "/dcma/rest";
String webServiceParamsFilePath = "C:\\sample\\extractKV.xml";
String hocrFilePath = "C:\\sample\\1.xml";
String HOCR_FILE_NAME_PARAM = "hocrFileName";
HttpClient client = new HttpClient();
Credentials defaultcreds = new UsernamePasswordCredentials(USERNAME, PASSWORD);
client.getState().setCredentials(new AuthScope(SERVER_NAME, PORT), defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
String webServiceUrl = HTTP + SERVER_NAME + COLON + PORT + DCMA_REST_PATH + "/extractKV";
PostMethod mPost = new PostMethod(webServiceUrl);
// Adding XML for the input.
File webServiceParamsFile = new File(webServiceParamsFilePath);
// Adding HOCR for processing.
File hocrFile = new File(hocrFilePath);
Part[] parts = new Part[3];
try {
parts[0] = new FilePart(webServiceParamsFile.getName(), webServiceParamsFile);
parts[1] = new FilePart(hocrFile.getName(), hocrFile);
// Following part is added to identify the hocr file among the attached xml files.
parts[2] = new StringPart(HOCR_FILE_NAME_PARAM, hocrFile.getName());
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int responseCode = client.executeMethod(mPost);
if (responseCode == 200) {

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
System.out.println("Web service executed successfully.");
String responseBody = mPost.getResponseBodyAsString();
// Generating result as responseBody.
System.out.println(responseCode + " *** " + responseBody);
} else if (responseCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

extractFixedForm

This API extracts the document level fields from the given RSP file and the image provided. This image should be tif/png
Web Service URL : http://{serverName}:{port}/dcma/rest/extractFixedForm

Input
Values Descriptions
Parameter
This parameter is used for extracting the data from color image or black and white
colorSwitch Either “ON”/”OFF”
image.
This value should not be empty and should have valid recostar project file
projectFile This is used for HOCRing the image file using project file associated.
name.

Format for project file :


<_Project MajorRevision="6" MinorRevision="0" Timeout="180000">
<_Collection Name="Libraries">
<_Library Type="Dll" BaseName="ImageProcess"/>
<_Library Type="Dll" BaseName="ImageProcess2"/>
<_Library Type="Dll" BaseName="FormIdent"/>

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
<_Library Type="Dll" BaseName="Recognition"/>
</_Collection>
<FormOperator Name="Operator" SetupImageFileName="" ProjectID="0" DefaultFormType="Voting_Pharmacy" ExternalFormType="" Country="USA" FormRegistration="Off"
FormReading="true" FormGeometry="0 0 0 0 0 0" ResultCoordinates="OriginalImage" ResultImage="Off" ResultGraphicalObjects="false" PassThroughID="Ignore"
DiagnosticsMode="OnError" DiagnosticsFileName="">
<ImageSequence2Operator Name="ImageProcessing" SetupImageFileName="" RegisterImage="false" DiagnosticsMode="OnError" DiagnosticsFileName=""
ConfigurationFileName="" Geometry="0 0 1488 0 0 1019">
<LoadImageOperator Name="ImageSourceOperator" FileName="" FileFormat="Unknown" Resolution="ReadFromFile" UnifyResolution="false" RepairResolution="false"
AutoRotate="false" IgnorePalette="true" ScaleToGray="0"/>
<ExtractGrayFromRgbOperator Name="ColorFilterOperator" LumaRed="0.299" LumaGreen="0.587" LumaBlue="0.114"/>
<BinarizeEdgeAdaptiveOperator Name="BinarizeOperator" EdgeThreshold="80" DoubleResolution="false"/>
<_Collection Name="BinaryImageSequence">
<DetectPaperAreaOperator Name="DetectPaperArea" KeepBlackFrame="false" SafetyClass="Medium" DetectTextSkew="false"/>
</_Collection>
</ImageSequence2Operator>
<_Collection Name="Forms">
<FormRecoOperator Name="Voting_Pharmacy" SetupImageFileName="" SetupImageWidth="125.98" SetupImageHeight="86.27">
<_Collection Name="RecoOperators">
<IcrField Name="Field1" Zone="440 1151 11269 796 0 1" ReaderSelection="Voter" Orientation="Normal" SyntaxMode="Alphanumerical" Font="Unknown" NumberOfLines="1"
HandprintHeight="5.50" HandprintPitch="5.00" HandprintMinConfidence="100" MachinetypeHeight="Unknown" MachinetypePitch="Unknown"
MachinetypeMinConfidence="100" LogicalContext="On" TrigramMode="On" DictionaryFileName="" DictionaryMode="Incomplete" DictionaryCandidates="Words"
CharacterSet="" Pattern="^[$%*+,\-.0-9:;<=>?A-Z\\a-z]*$" LeftBoundaryHandling="On" TopBoundaryHandling="On" RightBoundaryHandling="On"
BottomBoundaryHandling="On" Classifiers="" PassThroughID="None">
<_Collection Name="IgnoreAreas"/>
</IcrField>
<IcrField Name="Field2" Zone="593 1930 11803 796 0 1" ReaderSelection="Voter" Orientation="Normal" SyntaxMode="Numerical" Font="Unknown" NumberOfLines="1"
HandprintHeight="5.50" HandprintPitch="5.00" HandprintMinConfidence="100" MachinetypeHeight="Unknown" MachinetypePitch="Unknown"
MachinetypeMinConfidence="100" LogicalContext="On" TrigramMode="On" DictionaryFileName="" DictionaryMode="Incomplete" DictionaryCandidates="Words"
CharacterSet="" Pattern="^[$*+,\-.0-9\\]*$" LeftBoundaryHandling="On" TopBoundaryHandling="On" RightBoundaryHandling="On" BottomBoundaryHandling="On"
Classifiers="" PassThroughID="None">
<_Collection Name="IgnoreAreas"/>
</IcrField>
</_Collection>
</FormRecoOperator>
</_Collection>
<FormGenerator Name="Generator"/>
</FormOperator>
</_Project>

Sample for XML:


<WebServiceParams>
<Params>
<Param>
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
<Name>colorSwitch</Name>
<Value>off</Value>
</Param>
<Param>
<Name>projectFile</Name>
<Value>Fpr.rsp</Value>
</Param>
</Params>
</WebServiceParams>

CheckList:
i. projectFile should have fields like we have marked yellow in above.
ii. If colorSwitch is ON than image should be png.
iii. If colorSwitch is OFF than image should be tif/tiff.

Sample Input Used:


extract-fixed-form.zip

Sample client code using apache commons http client:-


private static void extractFixedForm() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/extractFixedForm ";
PostMethod mPost = new PostMethod(url);
// adding file for sending
File file1 = new File("C:\\sample\\WebServiceParams.xml");
File file2 = new File("C:\\sample\\Voting_Pharmacy.rsp");
Part[] parts = new Part[2];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = mPost.getResponseBodyAsString();
// Generating result as responseBody.
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

extractFieldFromHocr

This API will extract the KV pattern for the given word in the given HOCR file. Web Service URL : http://{serverName}:{port}/dcma/rest/extractFieldFromHocr

Input Parameter Values Descriptions


fieldValue This should not be empty. This parameter is used for extracting the Key Value pattern for the word provided.

CheckList:
i. fieldValue is provided for the word on which Key Value pattern would be found.

Sample Input Used:


extract-field-from-hocr.zip

Sample client code using apache commons http client:-


private static void extractFieldFromHocr() {
String COLON = ":";
String HTTP = "http://";
String DCMA_REST_PATH = "/dcma/rest";
String PASSWORD = "demo";
String USERNAME = "ephesoft";
int PORT = 8080;
String SERVER_NAME = "localhost";
String fieldValue = "Invoice";
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
String FIELD_VALUE_PARAM = "fieldValue";
String hocrFilePath = "E:\\Temp\\WS\\US-Invoice_HOCR.xml";
HttpClient client = new HttpClient();
Credentials defaultcreds = new UsernamePasswordCredentials(USERNAME, PASSWORD);
client.getState().setCredentials(new AuthScope(SERVER_NAME, PORT), defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
String webServiceUrl = HTTP + SERVER_NAME + COLON + PORT + DCMA_REST_PATH + "/extractFieldFromHocr";
PostMethod mPost = new PostMethod(webServiceUrl);
// Adding XML for extracting field
File hocrFile = new File(hocrFilePath);
Part[] parts = new Part[2];
try {
parts[0] = new FilePart(hocrFile.getName(), hocrFile);
// Adding field value for extracting Key Value Pattern.
parts[1] = new StringPart(FIELD_VALUE_PARAM, fieldValue);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int responseCode = client.executeMethod(mPost);
if (responseCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = mPost.getResponseBodyAsString();
System.out.println(responseCode + " *** " + responseBody);
} else if (responseCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
}

extractFuzzyDB
This API will create the document level fields for the document type for the specified batch class for HOCR file passing it.
Web Service URL : http://{serverName}:{port}/dcma/rest/extractFuzzyDB

Input Parameter Values Descriptions


This parameter is used for generating document level fields for defined
documentType This should not be empty and valid document type for that batch class
document type.
This parameter used for fetching the information of the document for defined
batchClassIdentifier This should not be empty and valid batch class identifier
document type
This value should not be empty and should have same name as HOCR file
hocrFile This parameter is used for verifying the HOCR file name.
attached for processing

CheckList:-
i. hocrFile should have same HOCR file name that are passed for processing.
ii. BatchClass having that batchClassIdentifier should have fuzzyDB plugin for processing.
iii. DocumentType should have document level fields for specified document type.

Sample Input Used:


extract-fuzzy-db.zip

Sample client code using apache commons http client:-


private static void extractFuzzyDB() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/extractFuzzyDB ";
PostMethod mPost = new PostMethod(url);
// Adding HOCR file for processing
File file = new File("C:\\sample\\Application-Checklist_000.html");
Part[] parts = new Part[4];
try {
parts[0] = new FilePart(file.getName(), file);
// Adding parameter for docuement type.
parts[1] = new StringPart("documentType", "Application-Checklist");
// Adding parameter for batch class.
parts[2] = new StringPart("batchClassIdentifier", "BC1");
parts[3] = new StringPart("hocrFile", "Application-Checklist.html");
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = mPost.getResponseBodyAsString();
// Generating result as responseBody.
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

barcodeExtraction
This API will create the document level fields for the document type for the specified batch class for barcode in tiff files passing it.
Web Service URL : http://{serverName}:{port}/dcma/rest/barcodeExtraction

Input Parameter Values Descriptions


This should not be empty and valid document type for that batch
documentType This parameter is used for generating document level fields for defined document type.
class
This parameter used for fetching the information of the document for defined document
batchClassIdentifier This should not be empty and valid batch class identifier
type
imageName This value should not and empty. On this file extraction operation will be performed.

CheckList:-
i. BatchClass having that batchClassIdentifier should have Barcode Extraction plugin for processing.
ii. DocumentType should have document level fields for specified document type.
iii. Image name should have valid extension i.e. TIF/TIFF.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Sample Input Used:
barcodeExtraction.zip

Sample client code using apache commons http client:-


private static void barcodeExtraction() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/barcodeExtraction ";
PostMethod mPost = new PostMethod(url);
File file1 = new File("C:\\sample\\sample.tif");
// adding xml file for taking input
File file2 = new File("C:\\sample\\WebServiceParams-barcodeExtraction.xml");
Part[] parts = new Part[2];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
System.out.println(mPost.getResponseBodyAsString());
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

regularRegexExtraction
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
This API will extract the document level fields for the document type for the specified batch class.
Web Service URL : http://{serverName}:{port}/dcma/rest/extractFieldsUsingRegex

Input Parameter Values Descriptions


This should not be empty and valid document type for that batch
documentType This parameter is used for generating document level fields for defined document type.
class
This parameter used for fetching the information of the document for defined document
batchClassIdentifier This should not be empty and valid batch class identifier
type.
hocrFile This value should not be empty. HTML file name for which document level fields will be extracted.

CheckList:-
i. This batch class specified should have Regular Regex plugin defined for it.
ii. DocumentType should have document level fields for specified document type.
iii. HOCR file name should have valid extension, i.e., HTML.

Sample Input Used:


regularRegexExtraction.zip

Sample client code using apache commons http client:-


private static void extractFieldsUsingRegex() {
String SERVER_NAME = "localhost";
int PORT = 8080;
String USERNAME = "ephesoft";
String PASSWORD = "demo";
String COLON = ":";
String HTTP = "http://";
String DCMA_REST_PATH = "/dcma/rest";
HttpClient client = new HttpClient();
Credentials defaultcreds = new UsernamePasswordCredentials(USERNAME, PASSWORD);
client.getState().setCredentials(new AuthScope(SERVER_NAME, PORT), defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
String webServiceUrl = HTTP + SERVER_NAME + COLON + PORT + DCMA_REST_PATH + "/extractFieldsUsingRegex";
PostMethod mPost = new PostMethod(webServiceUrl);
File hocrFile = new File("C:\\sample\\1.xml");
// adding xml file for taking input
File webServiceParamFiles = new File("C:\\sample\\WebServiceParams.xml");
Part[] parts = new Part[3];
try {
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
parts[0] = new FilePart(hocrFile.getName(), hocrFile);
parts[1] = new FilePart(webServiceParamFiles.getName(), webServiceParamFiles);
parts[2] = new StringPart("hocrFileName", hocrFile.getName());
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int responseCode = client.executeMethod(mPost);
if (responseCode == 200) {
System.out.println("Web service executed successfully.");
System.out.println(mPost.getResponseBodyAsString());
} else if (responseCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

commonAPIForExtraction

This API is required to set the Header in the client for which the extraction to be performed. Rest of the information for the individual api found above.
Input for Extraction Type:
Pass the name of extraction api that is to use in the client header as shown in following example: BARCODE_EXTARCTION, RECOSTAR_EXTARCTION,
REGULAR_REGEX_EXTRACTION, KV_EXTRACTION, FUZZY_DB
Here’s the sample client code using Regular Regex Extraction:
private static void extractFields() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/extractFields ";
PostMethod mPost = new PostMethod(url);
File file1 = new File("C:\\sample\\input\\sample1.html");
// adding xml file for taking input
File file2 = new File("C:\\sample\\input\\WebServiceParams.xml");

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Part[] parts = new Part[2];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
/* Pass the name of extraction api that is to used:
BARCODE_EXTARCTION
RECOSTAR_EXTARCTION
REGULAR_REGEX_EXTRACTION
KV_EXTRACTION
FUZZY_DB*/
Header header = new Header("extractionAPI", "REGULAR_REGEX_EXTRACTION");
mPost.addRequestHeader(header);
mPost.setRequestEntity(entity);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
System.out.println(mPost.getResponseBodyAsString());
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
::::System.out.println(mPost.getResponseBodyAsString());
} } catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

OCR Web Service

createOCR

This API will generates the OCR result for the specified sample image file. This API works for tif and png file. If processing the color image we accept the png/tif file as input and for
black and white image we processing tif file as input.
Web Service URL : http://{serverName}:{port}/dcma/rest/createOCR

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Input Parameter Values Descriptions
ocrEngine Either “recostar”/”tesseract” This parameter is used for configuring the ocrEngine to be used
colorSwitch Either “ON”/”OFF” This parameter is used
tesseractVersion Currently we are supporting “tesseract_version_3” This parameter is used for tesseract version to be used.
cmdLanguage Either “tha”/”eng” This parameter is used for configure the language that has been learnt by tessearact
projectFile This can be empty in case of tesseract ocrEngine This parameter is validating the RSP used for OCRing in case of recostar

CheckList:-
i. In case of ocrEngine is recostar, than colorSwitch and projectFile is mandatory parameters.
ii. In case of ocrEngine is tesseract than colorSwitch, tesseractVersion and cmdLanguage is mandatory parameters.
iii. If colorSwitch is ON, input image can be tif/png.
iv. If colorSwitch is OFF than input image should be TIFF.

Sample Input Used:


create-ocr.zip

File format for XML file:


<WebServiceParams>
<Params>
<Param>
<Name>ocrEngine</Name>
<Value>recostar</Value>
</Param>
<Param>
<Name>colorSwitch</Name>
<Value>off</Value>
</Param>
<Param>
<Name>tesseractVersion</Name>
<Value>tesseract_version_3</Value>
</Param>
<Param>
<Name>cmdLanguage</Name>
<Value>eng</Value>
</Param>
<Param>
<Name>projectFile</Name>
<Value>Fpr.rsp</Value>

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
</Param>
</Params>
</WebServiceParams>

Format for RSP file:


<_Project MajorRevision="1" MinorRevision="0" Timeout="180000">
<_Collection Name="Libraries">
<_Library Type="Dll" BaseName="ImageProcess"/>
<_Library Type="Dll" BaseName="ImageProcess2"/>
<_Library Type="Dll" BaseName="Recognition"/>
</_Collection>
<FullPageOperator Name="Operator" SetupImageFileName="" Country="USA" TextReading="true" ResultCoordinates="OriginalImage" ResultImage="RecoImage"
ResultGraphicalObjects="false" DiagnosticsMode="OnError" DiagnosticsFileName="">
<ImageSequence2Operator Name="ImageProcessing" SetupImageFileName="" RegisterImage="true" DiagnosticsMode="OnError" DiagnosticsFileName=""
ConfigurationFileName="" Geometry="-1 0 1683 0 1 2190">
<LoadImageOperator Name="ImageSourceOperator" FileName="" FileFormat="Unknown" Resolution="200" UnifyResolution="true" RepairResolution="true"
AutoRotate="false" IgnorePalette="false" ScaleToGray="0"/>
<ExtractGrayFromRgbOperator Name="ColorFilterOperator" LumaRed="0.299" LumaGreen="0.587" LumaBlue="0.114"/>
<BinarizeEdgeAdaptiveOperator Name="BinarizeOperator" EdgeThreshold="80" DoubleResolution="false"/>
<_Collection Name="BinaryImageSequence">
<RemoveShadingOperator Name="RemoveShading" MinRegionWidth="10.00" MinRegionHeight="3.00"/>
<DetectPaperAreaOperator Name="DetectPaperArea" KeepBlackFrame="false" SafetyClass="Medium" DetectTextSkew="true"/>
<BinaryAutoRotateOperator Name="AutoRotate" DocumentOrientation="Unknown" InputOrientation="MostlyCorrect"/>
<ProtectBarCodesOperator Name="ProtectBarCodes" SafetyClass="Medium" SearchRegion=""/>
<RemoveLineSystemOperator Name="RemoveLineSystem" HorizontalLineLength="10.00" VerticalLineLength="12.00" DashedLineLength="30.00" MaxLineWidth="1.50"
MaxGapWidth="1.00" BoxSeparatorHeight="4.00" InvertedRegionWidth="12.00" InvertedRegionHeight="4.00" LineQuality="Medium"/>
</_Collection>
</ImageSequence2Operator>
<LayoutOperator Name="LayoutOperator" FindTextBlocks="true"/>
<FullPageField Name="TextField" Zone="0 0 0 0 0 1" ReaderSelection="Voter" Orientation="Normal" SyntaxMode="Alphanumerical" NumberOfLines="TextLineSegments"
MachinetypeHeight="Unknown" MachinetypePitch="Unknown" MachinetypeMinConfidence="100" LogicalContext="On" TrigramMode="On" DictionaryFileName=""
DictionaryMode="Incomplete" DictionaryCandidates="Words" CharacterSet="" Pattern="" PassThroughID="None"/>
<FormGenerator Name="Generator"/>
</FullPageOperator>
</_Project>

Sample client code using apache commons http client:-


private static void createOCR() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/createOCR ";
PostMethod mPost = new PostMethod(url);

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
// adding image file for processing
File file1 = new File("C:\\sample\\sample1.tif");
// adding xml file for taking input
File file2 = new File("C:\\sample\\WebServiceParams.xml");
// adding rsp file used for creating OCR in case of recostar
File file3 = new File("C:\\sample\\Fpr.rsp");
Part[] parts = new Part[3];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
parts[2] = new FilePart(file3.getName(), file3);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
InputStream in = mPost.getResponseBodyAsStream();
// saving result generated.
File outputFile = new File("C:\\sample\\serverOutput.zip");
FileOutputStream fos = new FileOutputStream(outputFile);
try {
byte[] buf = new byte[1024];
int len = in.read(buf);
while (len > 0) {
fos.write(buf, 0, len);
len = in.read(buf);
}
} finally {
if (fos != null) {
fos.close();
}
}
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

Users and Groups Web Service

getBatchInstanceForRole

This API is used to fetch all batch instance list having accessed by the specified role. This API is GET api, works with web url and client code.
Web Service URL : http://{serverName}:{port}/dcma/rest/getBatchInstanceForRole/{role}

Input Parameter Values Descriptions


role This value should not be empty. This parameter is used for specifying the role name for which batch instance list to be fetched

Sample client code using apache commons http client:-


private static void getBatchInstanceForRole() {
HttpClient client = new HttpClient();
// URL path to be hit for getting the batch instance list having accessed by the role specified.
String url = "http://localhost:8080/dcma/rest/getBatchInstanceForRoles/admin ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

getBatchClassForRole:

This API is used to fetch all batch class list having accessed by the specified role. This API is GET api, works with web url and client code.
Web Service URL : http://{serverName}:{port}/dcma/rest/getBatchClassForRole/{role}

Input Parameter Values Descriptions


role This value should not be empty. This parameter is used for specifying the role name for which batch class list to be fetched.

Sample client code using apache commons http client:-


private static void getBatchClassForRole() {
HttpClient client = new HttpClient();
// URL path to be hit for getting the batch class list having accessed by the role specified.
String url = "http://localhost:8080/dcma/rest/getBatchClassForRole/admin ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

Reporting Web Service

runReporting

This API is used to run reporting on using web services. This web service takes server side installer path as an input and performs synchronizing the report database.
Web Service URL : http://{serverName}:{port}/dcma/rest/runReporting

Input Parameter Values Descriptions


installerPath This value should be valid path. This parameter is used for specifying path fie build.xml for reporting present on the server side.

Checklist :-
i. This path should be valid file path and must be server path for the build.xml file.

Sample Input Used:


run-reporting.zip

Format for inputXML file :


<ReportingOptions>
<installerPath>C:\\testing</installerPath>
</ReportingOptions>

Sample client code using apache commons http client:-


private static void runReporting() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/runReporting ";
PostMethod mPost = new PostMethod(url);
File file1 = new File("C:\\sample\\reporting.xml");
Part[] parts = new Part[1];
try {

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
parts[0] = new FilePart(file1.getName(), file1);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = mPost.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.out.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

Batch Instance Management Web Service

getBatchInstanceList

This api will return the batch instance list of the batch instance status accessed for the specific role using in the authentication. This API is GET api, works with client code and URL
directly.
Web Service URL : http://{serverName}:{port}/dcma/rest/getBatchInstanceList/{status}

Input
Values Descriptions
Parameter
This values can be NEW, LOCKED,READY,ERROR, FINISHED,ASSIGNED, RUNNING, READY_FOR_REVIEW,
status READY_FOR_VALIDATION, RESTARTED, DELETED, TRANSFERRED, RESTART_IN_PROGRESS || This parameter is used for specifying the batch
instance status for which batch instance list to be fetched.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Checklist:-
i. Status should have status provided above in the list.

Sample client code using apache commons http client:-


private static void getBatchInstanceList() {
HttpClient client = new HttpClient();
// URL path to be hit for getting the batch instance identifier list having status specified.
String url = "http://localhost:8080/dcma/rest/getBatchInstanceList/RUNNING ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

getAllModulesWorkflowNameByBatchClass

API will returns the module workflow names and the module names of the specified batch class identifier. This API is GET API, works with client code and web url.
Web Service URL : http://{serverName}:{port}/dcma/rest/getAllModulesWorkflowNameByBatchClass/{batchClassIdentifier}

Input Parameter Values Descriptions


open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
batchClassIdentifier This value should not be empty. This parameter is used for specifying the batch class identifier for which module name to be fetched.

Sample client code using apache commons http client:-


private static void getAllModulesWorkflowNameByBatchClass() {
HttpClient client = new HttpClient();
// URL path to be hit for getting the mdoule workflow name of the specified batch class identifier
String url = "http://localhost:8080/dcma/rest/getAllModulesWorkflowNameByBatchClass/BC1 ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

restartBatchInstance

This API is used to restart the batch instance from specified module. User can restart those batch instances those are accessible by their role. This API is GET api, works with client
code and web url.
Web Service URL : http://{serverName}:{port}/dcma/rest/restartBatchInstance/{batchInstanceIdentifier}/{restartAtModuleName}

Input Parameter Values Descriptions

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
batchClassIdentifier This value should be valid batch instance identifier. This parameter is used to specifying the batch instance identifier for which batch instance to be restart.
restartAtModuleName This value should not be empty This parameter is used specifying the module name from where batch to be restart.

Checklist:-
i. Batch Instance identifier should be valid identifier and having access by the user which are authenticate the web service.
ii. restartAtModuleName this value should valid module name and it can be differ with batch class.

Sample client code using apache commons http client:-


private static void restartBatchInstance() {
HttpClient client = new HttpClient();
// URL path to be hit for restarting batch instance identifier from specified module.
// User can restart only those batch instance having status "ERROR", "READY_FOR_REVIEW", "READY_FOR_VALIDATION", "RUNNING"
String url = "http://{serverName}:{port}/dcma/rest/restartBatchInstance/BI1/Folder_Import_Module ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

deleteBatchInstance

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
This API is used to delete the batch instance for specified batch instance identifier. This API will delete that batch instance having accessed by the authenticated user.
Web Service URL : http://{serverName}:{port}/dcma/rest/deleteBatchInstance/{identifier}

Input Parameter Values Descriptions


batchClassIdentifier This value should be valid batch instance identifier. This parameter is used to specifying the batch instance identifier to be deleted.

Sample client code using apache commons http client:-


private static void deleteBatchInstance() {
HttpClient client = new HttpClient();
// URL path to be hit for deleting the batch instance having access to the authenticated user.
// User can delete only those batch instance having status "ERROR", "READY_FOR_REVIEW", "READY_FOR_VALIDATION", "RUNNING"
String url = "http://localhost:8080/dcma/rest/deleteBatchInstance/BI1 ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

restartAllBatchInstance

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
This API is used to restart all the batch instance having status READY_FOR_REVIEW and READY_FOR_VALIDATION and having access by the authenticated user. This API is GET
API, works with clinet code and web url.
Web Service URL : http://{serverName}:{port}/dcma/rest/restartAllBatchInstance

Checklist:-
i. Only those batch will restart having status READY_FOR_REVIEW and READY_FOR_VALIDATION which are accessible by authenticated user.

Sample client code using apache commons http client:-


private static void restartAllBatchInstance() {
HttpClient client = new HttpClient();
// URL path to be hit for restarting the batch instance having access to the authenticated user.
// User can restart only those batch instance having status "READY_FOR_REVIEW", "READY_FOR_VALIDATION"
String url = "http://localhost:8080/dcma/rest/restartAllBatchInstance ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

addUserRolesToBatchInstance

This API is used to adding roles to batch instance identifier. This API takes batch instance identifier and role name as an input and adding it to the database. This API is GET api,
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
works with client code and web browser both.
Web Service URL : http://{serverName}:{port}/dcma/rest/addUserRolesToBatchInstance/{batchInstanceIdentifier}/{userRole}

Input Parameter Values Descriptions


batchInstanceIdentifier This value should be valid batch instance identifier. This parameter is used to specifying the batch instance identifier for which roles to be added.
userRole This value should not be empty. This parameter is used specifying the role to be added on the specified batch instance identifier.

Sample client code using apache commons http client:-


private static void addUserRolesToBatchInstance() {
HttpClient client = new HttpClient();
// URL path to be hit for adding user roles to batch instance identifier
String url = "http://localhost:8080/dcma/rest/addUserRolesToBatchInstance/BI45/admin ";
GetMethod getMethod = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(getMethod);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = getMethod.getResponseBodyAsString();
vSystem.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(getMethod.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}

Batch Class Management Web Service

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
importBatchClass
This API is used for importing batch class to the ephesoft. This API takes XML for input parameters and exported batch class data as an input. Exported batch class is in zip format as
exported by Ephesoft.
Web Service URL : http://{serverName}:{port}/dcma/rest/importBatchClass

Input
Values Descriptions
Parameter
RolesImported Either “true”/”false” This value is used for importing roles with batch class or not.
EmailAccounts Either “true”/”false” This value is used for importing email accounts with batch class or not.
UseSource Either “true”/”false” This value is used for saving the information of source batch class to be imported
Name This value should not be empty This value is used to configure the batch class name of the imported batch class.
Description This value should not be empty This value is used to configure the description of the imported batch class.
Priority This value should lie in between 1 to 100. This value indicates the priority of batch class.
UseExisting Either “true”/”false” This value is used for overwrite the existing batch class with new batch class.
This value should not be empty and have any string value that specified These values specify the UNC folder path for batch class to be imported along with
UncFolder
directory path batch class.
Script This tag is configured for ScriptFile to be imported This tag is configured for which Script file to be imported
Folder This tag is configured for Folder to be imported This tag is configured for which folder to be imported along with batch class

Checklist:-
i. If UseExisting is “true”, existing batch class will be overwriting with the Folders and Script as well as others parameter.
ii. If UseExisting is “false”, new batch class will created and Folders and Scripts will be used as false.
iii. If UseSource is “true”, new batch class will have same Name, Description and Priority as source batch class.
iv. If UseSource is “false”, new batch class will have property like Name, Description and Priority configured.

SampleInputXML:
<ImportBatchClassOptions>
<RolesImported>false</RolesImported>
<EmailAccounts>true</EmailAccounts>
<UseSource>false</UseSource>
<Name>BatchClassName</Name>
<Description>Description</Description>
<Priority>10</Priority>
<UseExisting>true</UseExisting>
<UncFolder>C:\ephesoft-data\Test-UNC</UncFolder>
<BatchClassDefinition>
<Scripts>

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
<Script>
<FileName>ScriptDocumentAssembler.java</FileName>
<Selected>true</Selected>
</Script>
<Script>
<FileName>ScriptPageProcessing.java</FileName>
<Selected>true</Selected>
</Script>
</Scripts>
<Folders>
<Folder>
<FileName>image-classification-sample</FileName>
<Selected>false</Selected>
</Folder>
</Folders>
<BatchClassModules>
<BatchClassModule>
<ModuleName></ModuleName>
<PluginConfiguration>true</PluginConfiguration>
</BatchClassModule>
</BatchClassModules>
</BatchClassDefinition>
</ImportBatchClassOptions>
Sample client code using apache commons http client:-
private static void importBatchClass() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/importBatchClass ";
PostMethod mPost = new PostMethod(url);
mPost.setDoAuthentication(true);
// Input XML for adding parameter.
File file1 = new File("C:\\sample\\importbatchclass.xml");
// Input zip file for importing batch class.
File file2 = new File("C:\\sample\\BC1_050712_1714.zip");
Part[] parts = new Part[2];
try {
parts[0] = new FilePart(file1.getName(), file1);
parts[1] = new FilePart(file2.getName(), file2);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
mPost.setRequestEntity(entity);

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
int statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Batch class imported successfully");
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.out.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

exportBatchClass

This API is used for exporting existing batch class. This method will take the batch class identifier and learnt-sample to be exported with the batch class.
Web Service URL : http://{serverName}:{port}/dcma/rest/exportBatchClass

Input Parameter Values Descriptions


This value should not be empty and valid batch class
identifier This parameter is used for identifying which batch class is to be exported.
identifier.
lucene-search-classification- This parameter is used to configure the lucene learnt sample is exported with batch class or
Either “true”/”false”
sample not.
This parameter is used to configure the image classification sample is exported with batch
image-classification-sample Either “true”/”false”
class or not.

CheckList:-
i. Identifier should be batch class identifier.

Sample client code using apache commons http client:-

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
private static void exportBatchClass() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/exportBatchClass ";
PostMethod mPost = new PostMethod(url);
mPost.addParameter("identifier", "BC1");
mPost.addParameter("lucene-search-classification-sample", "true");
mPost.addParameter("image-classification-sample", "false");
int statusCode;
try {
statusCode = client.executeMethod(mPost);
if (statusCode == 200) {
System.out.println("Batch class exported successfully");
InputStream in = mPost.getResponseBodyAsStream();
File f = new File("C:\\sample\\serverOutput.zip");
FileOutputStream fos = new FileOutputStream(f);
try {
byte[] buf = new byte[1024];
int len = in.read(buf);
while (len > 0) {
fos.write(buf, 0, len);
len = in.read(buf);
}
} finally {
if (fos != null) {
fos.close();
}
}
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
}
}
}

getBatchClassList

This API returns all the batch class having accessible by the authenticated user. This API is GET API, works with the client code and web url.
Web Service URL : http://{serverName}:{port}/dcma/rest/getBatchClassList

Sample client code using apache commons http client:-


private static void getBatchClassList() {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/getBatchClassList ";
GetMethod mGet = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(mGet);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = mGet.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mGet.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mGet != null) {
mGet.releaseConnection();
}
}
}

getRoles

This API is used to get the roles of the specified batch class. This API is GET API, works with the client code and web url.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Web Service URL : http://{serverName}:{port}/dcma/rest/getRoles/{batchClassIdentifier}

Input Parameter Values Descriptions


identifier This value should not be empty and valid batch class identifier This parameter is used for identifying which batch class roles to be fetched.

CheckList:-
i. Identifier should be batch class identifier.

Sample client code using apache commons http client:-


private static void getRoles () {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/getRoles/BC1 ";
GetMethod mGet = new GetMethod(url);
int statusCode;
try {
statusCode = client.executeMethod(mGet);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
String responseBody = mGet.getResponseBodyAsString();
System.out.println(statusCode + " *** " + responseBody);
} else if (statusCode == 403) {
System.out.println("Invalid username/password.");
} else {
System.out.println(mGet.getResponseBodyAsString());
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mGet != null) {
mGet.releaseConnection();
}
}
}

Uploading a Batch through a Web Service


uploadBatch

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
This API is for uploading a new batch to a watch folder for a given batch class. It executes the new batch with supplied tif, tiff or pdf files. User need to be authorized to execute a batch
for a particular batch class otherwise an error message would be generated. All the files would be copied to the unc folder of the requested batch class with the folder name supplied by
the user as input.

Web Service URL : http://{serverName}:{port}/dcma/rest/uploadBatch/{batchClassIdentifier}/{batchInstanceName }

Input Parameter Descriptions


batchClassIdentifier The identifier of the batch class in which user wishes to upload its batch.
batchInstanceName This name with which user wishes to upload the batch.

CheckList:

i. The value for batchClassIdentifier is compulsory and should be valid with permissions to the user to run the batch on it.
ii. The value for batchInstanceName is compulsory and if left empty then it will send an error.

Sample client code using apache commons http client:


private static void uploadBatch () {
HttpClient client = new HttpClient();
String url = "http://localhost:8080/dcma/rest/uploadBatch/{BatchClassIdentifier}/{BatchInstanceName} ";
PostMethod mPost = new PostMethod(url);
Credentials defaultcreds = new UsernamePasswordCredentials("userName", "password");
client.getState().setCredentials(new AuthScope("localhost", 8080), defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
// adding image file for processing
File file1 = new File("C:\\sample\\sample1.tif");
Part[] parts = new Part[1];
try {
parts[0] = new FilePart(file1.getName(), file1);
MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());

mPost.setRequestEntity(entity);
int statusCode = client.executeMethod(mPost);
String responseBody = mPost.getResponseBodyAsString();
// Generating result as responseBody.
System.out.println(statusCode + "***" + responseBody);
if (statusCode == 200) {
System.out.println("Web service executed successfully.");
} else if (statusCode == 403) {

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
System.out.println("Invalid username/password.");
} else {
System.out.println(mPost.getResponseBodyAsString());
}
} catch (FileNotFoundException e) {
System.err.println("File not found for processing.");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (mPost != null) {
mPost.releaseConnection();
}
}
}

This page w as last modified on 12 April 2013, at 13:12. This page has been accessed 41,006 times. Privacy policy About Ephesoft Community Disclaimers

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com

You might also like