Installation
The MobbSign Web SDK is a JavaScript component, distributed as the npm package @mobbeel/mobbsign. It renders a PDF viewer inside an iframe in your web application and captures the signature with the touchscreen of the device. Documents are stored and signed by MobbSign Server.
Requirements
- MobbSign Server
- API key and App IDProvided by Mobbeel.
- npm token
- Access token for the Mobbeel packagesProvided by Mobbeel.
- Tooling
Node.jsnpm- Devices
- TouchscreenDevices without a touchscreen are blocked by default.
Supported browsers
| Platform | Minimum versions |
|---|---|
| Android | Chrome 76 · Firefox 60 · Samsung Internet 7 · Android Browser 4.4 |
| iOS / iPadOS | iOS 10.3 · Safari 11 · Chrome 76 · Firefox 60 · Opera 16 |
| macOS | Safari 11 · Chrome 76 · Firefox 60 · Opera 56 |
| Windows | Edge 40 · Chrome 76 · Firefox 60 · Opera 40 |
1. Configure the npm token
Add the token to the .npmrc file in the root of your project (create the file if it does not exist):
//registry.npmjs.org/:_authToken=YOUR_NPM_TOKEN
Do not commit the token: add .npmrc to .gitignore, or read the token from an environment variable in your CI pipeline.
2. Install the package
npm install --save @mobbeel/mobbsign
3. Publish the assets
The package contains files that the browser must be able to download. Serve them from your web application, for example by copying them to your public assets folder in your build:
| File or folder | Contents |
|---|---|
mobbsign.js | The SDK. |
config.js | Configuration of the viewer. |
assets/css/styles.min.css | Styles of the component. |
assets/img/ | Icons. |
locales/ | Translations. |
Include the style sheet in your application:
<link rel="stylesheet" href="assets/mobbsign/assets/css/styles.min.css" />
4. Import the SDK
- HTML · JavaScript
- TypeScript
<script src="assets/mobbsign/mobbsign.js"></script>
<script>
new MobbSign({/* options */}).then((mobbsign) => mobbsign.load(documentId));
</script>
Declare the module, for example in mobbsign.d.ts at the root of your project:
declare module '@mobbeel/mobbsign';
Then import it:
import MobbSign from '@mobbeel/mobbsign';
5. Add the container
Add the element where the viewer will be rendered. It must have position: relative and a defined width and height:
<div id="mobbsign"></div>
#mobbsign {
position: relative;
width: 100%;
height: 80vh;
}
Next step
Upload a document and sign it in the Quick start.