Class: DocumentObject

DocumentObject()

new DocumentObject()

Methods

addPage(successCallback, errorCallback, parameters)

Add page to the Document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the documenttype and page ids.
Properties
Name Type Attributes Default Description
documentID String <optional>
"" id of the document where you would like to add the page
pageID String <optional>
"" id of the page you want to add to document
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back . errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var createdDocument = null;
var pageObject = null;
var pagearray = kfxCordova.kfxLibLogistics.createPagesArray();
pagearray.createPageObject(function(pageObj){
     pageObject = pageObj;
},function(error){
     alert(JSON.stringify(error));
},{side:"FRONT"});// use side:"BACK" to create back side image
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
   createdDocument = docObject;
},function(error){
   alert(JSON.stringify(error));
},"document type name");
createdDocument.addPage(function(document){
   alert("updated document is "+ JSON.stringify(document));
},function(error){
   alert (JSON.stringify(error));
},{documentID:createdDocument.documentID,pageID:pageObject.pageID});

delete(successCallback, errorCallback)

Delete the document object from the documentArray
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are JSONException,KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var createdDocument = null;
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
   createdDocument = docObject;
},function(error){
   alert(JSON.stringify(error));
},"document type name");
createdDocument.delete(successCallback,errorCallback);

getProperties(successCallback, errorCallback)

Get the properties of the document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back with document Object properties. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var createdDocument = null;
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
   createdDocument = docObject;
},function(error){
   alert(JSON.stringify(error));
},"document type name");
createdDocument.getProperties(successCallback,errorCallback);

removePage(successCallback, errorCallback, parameters)

Method to remove page to the Document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the documenttype and page ids.
Properties
Name Type Attributes Default Description
documentID String <optional>
"" id of the document where you would like to remove the page
pageID String <optional>
"" id of the page you want to remove from document
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var createdDocument =null;
var pageObject = null;
var pagearray = kfxCordova.kfxLibLogistics.createPagesArray();
pagearray.createPageObject(function(pageObj){
     pageObject = pageObj;
},function(error){
     alert(JSON.stringify(error));
},{side:"FRONT"});// use side:"BACK" to create back side image
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
   createdDocument = docObject;
},function(error){},"document type name");
createdDocument.removePage(function(document){
   alert("updated document is "+ JSON.stringify(document));
},function(error){
   alert(JSON.stringify(error));
},{documentID:createdDocument.documentID,pageID:pageObject.pageID});

updateFields(successCallback, errorCallback, parameters)

Update the fields of the Document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the documentType id and fields array.
Properties
Name Type Attributes Description
documentID String <optional>
the id of the document in which you want to update the fields
fields Array <optional>
updated list of fields
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back . errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var createdDocument = null;
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
      createdDocument = docObject;
},function(error){
      alert(JSON.stringify(error));
},"document type name");
createdDocument.updateFields(successCallback,errorCallback,{documentID:createdDocument.documentID,fields:createdDocument.fields});