Capture Bridge Javascript SDK
The Capture Bridge Javascript SDK contains classes for working with the service's HTTP API in a web browser or Electron application.
Contents
- Overview of Available Classes
- Samples
- Installation Methods
- Locating the Capture Bridge Service
- Class Hierarchy
Overview of Available Classes 🔗
- Camera - Contains methods for capturing photos and live feed frames from a Camera.
- CanonCamera - Class for working specifically with a Canon Camera.
- MockCamera - Class for working with a Mock Camera and allows for testing and development without a physical camera.
- Scanner - Contains methods for scanning documents from a document scanner.
- SignatureTablet - Contains methods for capturing capturing signatures and updating a tablet's display.
- Verifone - Class for working with a Verifone Point-of-Sale terminal for capturing signatures and rendering forms.
- TopazSigGem - Class for working with a Topaz SigGem Signature Tablet.
- ICAO - Contains methods for performing ICAO verification on an image.
- IFace - Innovatrics IFace SDK.
- CaptureBridge - Class for retrieving plugins and working with the HTTP Service.
- Plugin - Class for working with a plugin and retrieving devices that a plugin supports.
- Device - Class representing a device and methods that can be called on a device.
- Logs - Stream plugin logs.
Samples 🔗
The following sections contain links to complete examples utilizing the SDK.
Canon Camera
Mock Camera
Windows Scanner
Verifone
- Device Info
- Minimal Signature Capture
- Button
- Check Box
- Radio Button
- Keypad Input
- Photo
- Custom Signature Capture
- Multiple Controls
- Formatting
- Magstripe
- Reset
ICAO
IFace
Topaz Signature Pad
Installation Methods 🔗
Script Tag and Static Import
The SDK can be loaded from a <script>
tag within an HTML document, in either
the <head>
or <body>
tags. It's crucual to specify type="module"
in order
for the static import
declarations to work as expected. You may either load these scripts from the
Capture Bridge service at the base path of /sdk/js
, or you may copy the SDK
files to another web server or CDN.
HTML document
<html>
<head>
<title>Capture App</title>
<meta name="capturebridge:url" content="https://local.capturebridge.net:9001"/>
</head>
<body>
<script type="module" src="./app.js"></script>
</body>
</html>
Example app.js
script:
import CanonCamera from 'some/path/to/capture_bridge/sdk/js/CanonCamera.js'
// or to load it from Capture Bridge itself, note your installation of Capture
// Brige may be hosted at a different URL and you will need to adjust accordingly:
// import CanonCamera from 'https://local.capturebridge.net:9001/sdk/js/CanonCamera.js'
const camera = new CanonCamera()
// utilize camera methods...
NPM
The SDK can be installed from NPM and added to your project's
package.json
and bundled along with your bundler of choice:
npm install --save @capturebridge/sdk
Locating the Capture Bridge Service 🔗
By default, the SDK will use the browser Window's
origin for
locating the Capture Bridge service. For example, if the SDK is running from
the origin https://domain.tld
, the SDK will attempt to make HTTP requests to
https://domain.tld/plugin
to get a list of plugins. Therefore you will likely
need to manually specify the BASE_URL for
your specific Capture Bridge service's configuration.
The SDK will look in the following locations, in the following order, for a Base URL:
Meta Tag
A <meta>
tag in the document's <head>
with the name capturebridge:url
can
specify the desired URL to use, for example:
<html>
<head>
<title>Capture App</title>
<meta name="capturebridge:url" content="https://local.capturebridge.net:9001"/>
</head>
<body></body>
</html>
It is crucial to include this meta tag before the SDK is loaded.
window.CAPTURE_BRIDGE_URL
You can set the Base URL on the global Window object, for example:
window.CAPTURE_BRIDGE_URL = 'https://local.capturebridge.net:9001'
It is crucial to set this variable before the SDK is loaded.
Individual Constructor Overrides
You may also override the Base URL in the constructor of each SDK Class, for example:
const camera = new CanonCamera('https://local.capturebridge.net:9001')
Overriding the URL in a constructor takes precedence. This can also be useful for targeting remote Capture Bridge instances.
Class Hierarch 🔗
