Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

SignatureCapture API

Allows the device to take a signature and save it as an image. See the controller and view in the /app/SignatureUtil folder of the System API Samples application for an example.

Using JavaScript API

You can call the SignatureCapture methods from JavaScript as well as Ruby. To use the JavaScript API, add the public/js/rho_javascript_api.js file – created at build time as part of the application package – to the .html, .erb, or .js file calling the JavaScript method.

You must enable JavaScript by putting rho-javascript into extensions in your build.yml.

extensions: ["rho-javascript"]

You must have a RhoElements license to use the JavaScript API.

take

Opens a window on the device where user draws his signature. Saves the signature as an image.

Refer to signature capture in device capabilities for an example.

Ruby syntax:

Rho::SignatureCapture.take(callback_url, params)

JavaScript syntax:

Rho.SignatureCapture.take(callback_function, params)
callback_url url to callback method called after the user enters a signature or cancels. The callback parameters are status - 'ok' or 'cancel', and signature_uri - path to the image with signature.
params A hash containing the parameters.

Hash parameters for take method

imageFormat “jpg”, “png” or “bmp” On Windows Mobile and CE devices, only bmp is supported. On Blackberry devices only "png" is supported.
penColor color of pen used for drawing signature
penWidth width of pen
bgColor color of background

Inline Signature API

Windows Mobile and Windows CE devices support signature capture started in window, which you can show over current page (scrolling is not supported in this case). The Inline Signature API consists of the methods visible, capture, and clear.

As of Rhodes version 3.3.3, the Inline Signature API is removed from Rhodes. This feature is only supported in Zebra RhoMobile Suite. If you wish to use this feature, you will need to upgrade to RhoMobile Suite. Your application’s build.yml will also need to be modified to indicate the application type is ‘Rhoelements’. Additionally, a RhoElements license is required.

Refer to inline signature capture in device capabilities for examples.

visible

Display a window for hand writing, where the user draws his signature. Windows Mobile and Windows CE devices support signature capture started in window, which you can show over current page (scrolling is not supported in this case).

Refer to inline signature capture in device capabilities for an example.

Ruby syntax:

Rho::SignatureCapture.visible(visibility, params)

JavaScript syntax:

Rho.SignatureCapture.visible(visibility, params)
visibility true or false.
params A hash containing the parameters.

Hash parameters for visible method

imageFormat “jpg”, “png” or “bmp” On Windows Mobile and CE devices, only bmp is supported. On Blackberry devices only "png" is supported.
penColor color of pen used for drawing signature
penWidth width of pen
bgColor color of background
left Sets the top left horizontal position of the rectangular capture area in pixels
top Sets the top left vertical position of the rectangular capture area in pixels
width Sets the width of the rectangular capture area in pixels
height Sets the height of the rectangular capture area in pixels

capture

Saves signature to an image file and calls a callback. Windows Mobile and Windows CE devices support signature capture started in window, which you can show over current page (scrolling is not supported in this case).

Refer to inline signature capture in device capabilities for an example.

Ruby syntax:

Rho::SignatureCapture.capture(callback_url)

JavaScript syntax:

Rho.SignatureCapture.capture(callback_function)
callback_url url to callback method called after the user enters a signature.

clear

Clear the signature in the window. Windows Mobile and Windows CE devices support signature capture started in window, which you can show over current page (scrolling is not supported in this case).

Ruby syntax:

Rho::SignatureCapture.clear()

JavaScript syntax:

Rho.SignatureCapture.clear()
Back to Top