The Signature Decoder is used to enable or disable the Signature decoder.
signature (Decoder) <META> Syntax |
---|
<META HTTP-Equiv="scanner" content="Signature:[parameter]"> |
signature JavaScript Object Syntax: |
---|
By default the JavaScript Object 'scanner' will exist on the current page and can be used to interact directly with the signature. |
To Set signature parameters via JavaScript use the following syntax: scanner.Parameter = Value; e.g. scanner.signature = Value; |
Signature Ruby Object Syntax: |
---|
By default the Ruby Object 'Scanner' will exist on the current page and can be used to interact directly with the Signature. |
To Set Signature parameters via Ruby use the following syntax: Scanner.Parameter = Value e.g. Scanner.signature = Value |
Items listed in this section indicate parameters, or attributes which can be set.
Name | Possible Values | Description | Default Value |
---|---|---|---|
signature:[Value] | enabled / Disabled | Enables / Disables the Signature decoder. The barcode will be returned as a Data URI object with a jpeg mime type, you should specify the barcodeDataFormat and dataBufferSize parameters accordingly. | Device specific |
RhoElements Version | 2.1 or above |
---|---|
Supported Devices | All supported devices except: Android. |
Minimum Requirements | Scanner and device that supports the Signature decoder. |
Persistence | Transient - Decoder settings are only guaranteed to persist until the Scanner is disabled |
The following example enables the scanner to read only Signature barcodes:
<META HTTP-Equiv="scanner" Content="allDecoders:disabled"> <META HTTP-Equiv="scanner" Content="Signature:enabled"> <META HTTP-Equiv="scanner" Content="barcodeDataFormat:binary;dataBufferSize:5000"> <META HTTP-Equiv="scanner" Content="enabled">
The following example displays the signature panel with the default values:
def display SignatureCapture.visibility = 'visible' end
To call the this function from HTML, use the following code:
<li onclick="display();">Display signature panel</li>
Where ‘display()’ is a JavaScript function which looks like:
function display() { $.get('/app/SignatureCapture/display', { }); return false; }
The following example displays the signature panel at the bottom of the screen with a pen color and a background color, attaches a signature save event to save the signature event. This function can be called from HTML in a similar fashion to the one described above.
def displayWithParams #Get the width width = System::get_property('screen_width') #and the height of the screen height = System::get_property('screen_height') SignatureCapture.width=width SignatureCapture.height=120 #Position the signature panel at the bottom of our page SignatureCapture.left=0 SignatureCapture.top=(height-250) SignatureCapture.penWidth=2 SignatureCapture.name='signPanel1' SignatureCapture.penColor="#000000" SignatureCapture.bgColor="#D4D2D2" SignatureCapture.visibility='visible' SignatureCapture.signatureSaveEvent = url_for(:action => :signatureSaveEventListener) #Remember to create the 'Signatures' folder under the root of the device before executing this function! SignatureCapture.destination = "url('file://\\Signatures\\sig1.bmp')" end
The ‘signatureSaveEventListener’ is a function that looks like:
def signatureSaveEventListener WebView.execute_js("setFieldValue('Signature saved under Signatures folder in root');") end
And the ‘setFieldValue’ is a JavaScript function that sets the inner HTML of a div to the value received in the arguments.
The following function triggers a signature save and fires the ‘signatureSaveEvent’. The signature is saved as a bitmap in the directory specified in the signature destination:
def save SignatureCapture.capture end
The following function clears the signature panel:
def clear SignatureCapture.clear end