edatalia-websign 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -42
- package/favicon.ico +0 -0
- package/package.json +9 -4
- package/web-sign-core.js +1 -1
package/README.md
CHANGED
|
@@ -1,67 +1,245 @@
|
|
|
1
|
-
#
|
|
1
|
+
# WebSign
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**WebSign** is a JavaScript library developed by **Edatalia** for integrating handwritten digital signatures into PDF documents from any modern web browser. It supports native browser signing as well as advanced integration with Wacom STU and DTU signature tablets.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **Important:** WebSign works exclusively over **HTTPS** and with **UTF-8** encoding.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Modo **Full**: incluye funcionalidades extra como firma manual (no DTU por el momento).
|
|
9
|
-
- Detección automática de dispositivos compatibles (STU, DTU o modo display).
|
|
10
|
-
- Configuración flexible y override opcional por parte del usuario.
|
|
11
|
-
- Callback centralizado para controlar eventos como éxito, error, cancelación, etc.
|
|
7
|
+
---
|
|
12
8
|
|
|
9
|
+
## ✨ Features
|
|
13
10
|
|
|
11
|
+
- Handwritten PDF signing via browser, STU, or DTU tablets
|
|
12
|
+
- Signature positioning via fixed coordinates or float (text search)
|
|
13
|
+
- Certified PDF signatures with OCSP and timestamp support
|
|
14
|
+
- EBP templates for Wacom
|
|
15
|
+
- Supports Salesforce and restricted environments
|
|
16
|
+
- Multi-language support
|
|
17
|
+
- Custom signature widget appearance and metadata
|
|
18
|
+
- Multi-document signature
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
---
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
## 📦 Installation
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
Install via NPM:
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
```bash
|
|
27
|
+
npm install edatalia-websign
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then, import it in your JavaScript application:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import 'edatalia-websign';
|
|
34
|
+
```
|
|
35
|
+
> This will globally register the `WebSign` constructor in the browser context.
|
|
36
|
+
|
|
37
|
+
In your HTML or SPA component, place the following container:
|
|
22
38
|
|
|
23
39
|
```html
|
|
24
40
|
<div id="web-sign"></div>
|
|
25
41
|
```
|
|
26
|
-
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 Basic Usage
|
|
46
|
+
|
|
47
|
+
Example using a file input:
|
|
48
|
+
|
|
49
|
+
WebSign comes with default parameter values, but it's recommended to set them to your desired value depending on your needs. Also you need a bearer token to be able to sign.
|
|
27
50
|
```html
|
|
28
|
-
|
|
51
|
+
<input type="file" id="fileInput" />
|
|
52
|
+
<div id="web-sign"></div>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
document.getElementById("fileInput").addEventListener("change", (e) => {
|
|
56
|
+
const file = e.target.files[0];
|
|
57
|
+
|
|
58
|
+
const config = {
|
|
59
|
+
bearerToken: "Your bearer Token",
|
|
60
|
+
signatureType: "display",
|
|
61
|
+
language: "es"
|
|
62
|
+
//...
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const webSign = new WebSign(file, config, (event) => {
|
|
66
|
+
switch (event.type) {
|
|
67
|
+
case "signed":
|
|
68
|
+
console.log("Signed PDF:", event.data);
|
|
69
|
+
break;
|
|
70
|
+
default;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
</script>
|
|
29
75
|
```
|
|
30
|
-
|
|
76
|
+
---
|
|
77
|
+
WebSign constructor requires **three** parameters:
|
|
31
78
|
|
|
32
|
-
|
|
79
|
+
1. PDF INPUT FILE
|
|
80
|
+
2. CONFIG OBJECT
|
|
81
|
+
3. CALLBACK
|
|
33
82
|
|
|
34
|
-
|
|
83
|
+
## 📄 PDF Input Formats
|
|
35
84
|
|
|
36
|
-
|
|
85
|
+
You can provide the PDF to WebSign in three formats:
|
|
37
86
|
|
|
38
|
-
|
|
87
|
+
1. **HTML file input**
|
|
39
88
|
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
```js
|
|
90
|
+
const file = input.files[0]; // can be multi-document
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
2. **Base64 string**
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
const base64String = "JVBERi0xLjQKJ...";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
3. **Salesforce-compatible structure**
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
const pdfData = {
|
|
103
|
+
pdfB64: "base64_string",
|
|
104
|
+
pdfUrl: "https://url.to/your.pdf"
|
|
105
|
+
};
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## ⚙️ Configuration Parameters
|
|
111
|
+
|
|
112
|
+
All parameters below are part of the `config` object:
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
| Option | Type | Description |
|
|
116
|
+
|--------|------|-------------|
|
|
117
|
+
| `bearerToken` | `string` | Auth token for API communication |
|
|
118
|
+
| `debug` | `boolean` | To enable or disable error messages |
|
|
119
|
+
| `requestPermissions` | `boolean` | Request permissions for tablets via a button before launching the app. |
|
|
120
|
+
| `mainContainerWidth` | `string` | Width of the main container (e.g. `"100%"`, `"800px"`)|
|
|
121
|
+
| `mainContainerHeight` | `string` | Height of the main container (e.g. `"100%"`, `"800px"`) |
|
|
122
|
+
| `signatureContainerWidth` | `string` | Width of the signature container (e.g. `"100%"`, `"800px"`)|
|
|
123
|
+
| `signatureContainerHeight` | `string` | Height of the signature container (e.g. `"100%"`, `"800px"`) |
|
|
124
|
+
| `signatureEnvironment` | `string` | `"SANDBOX"` or `"PRO"` |
|
|
125
|
+
| `signatureServiceUrl` | `string` | Endpoint for signature |
|
|
126
|
+
| `signatureType` | `string` | `"stu"`, `"display"`, `"dtu"`, or `"auto"` |
|
|
127
|
+
| `signatureColorHex` | `string` | Hex color of signature stroke |
|
|
128
|
+
| `autoDownload` | `boolean` | Auto-download the signed PDF |
|
|
129
|
+
| `minPointsRequiredToSign` | `number` | Minimum stroke points required |
|
|
130
|
+
| `signatureThickness` | `number` | Stroke thickness (1–30) |
|
|
131
|
+
| `mouseEBP` | `boolean` | Enable mouse EBP |
|
|
132
|
+
| `viewPDF` | `boolean` | Enable PDF preview |
|
|
133
|
+
| `renderDefaultIndexPage` | `number` | PDF page to show initially |
|
|
134
|
+
| `requestedEncodingBits` | `number` | EBP encoding quality (1, 16, 24) |
|
|
135
|
+
| `requestPermissions` | `boolean` | Show permission button before start |
|
|
136
|
+
| `language` | `string` | UI language (e.g., `"es"`, `"en"`, `"fr"`) |
|
|
137
|
+
| `requestLocation` | `boolean` | Include geolocation metadata |
|
|
138
|
+
| `doPerformance` | `boolean` | Enable performance tracking |
|
|
139
|
+
| `dtuHtmlUrl` | `boolean` | Html path for dtu |
|
|
140
|
+
| `jsUrl` | `boolean` | Js path for dtu |
|
|
141
|
+
| `loadSignedPdf` | `boolean` | Upload the signed PDF upon completion of the signature |
|
|
142
|
+
| `encCertKey` | `string` | Value to define the public key for the biometric data encryption certificate. By default, the edatalia encryption certificate will be used. |
|
|
143
|
+
| `signatureTimeLimit` | `number` | Time limit to be able to sign |
|
|
144
|
+
| `widget` | `Object` | Specifies signature positioning in coordinates or by text search, custom text for the signature, etc. |
|
|
145
|
+
| `wacom` | `Object` | Specifies parameter for the wacom devices |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
widget: {
|
|
151
|
+
type: "float", // can be 'fixed' (absolute position) or 'float' (based on text search)
|
|
152
|
+
width: 160, // width of the signature area
|
|
153
|
+
height: 100, // height of the signature area
|
|
154
|
+
x: 0, // X position on the PDF page (used if type is 'fixed')
|
|
155
|
+
y: 0, // Y position on the PDF page (used if type is 'fixed')
|
|
156
|
+
page: 0, // PDF page number where the signature will appear
|
|
157
|
+
customText: [ // text displayed on the PDF after signing
|
|
158
|
+
{
|
|
159
|
+
text: "Documento firmado digitalmente",
|
|
160
|
+
fontSize: 6
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
text: "Fecha y hora: ##TIMESTAMP##",
|
|
164
|
+
fontSize: 4
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
text: null, // if 'float', this text will be searched in the PDF to place the signature
|
|
168
|
+
fieldName: null, // optional name of the signature field
|
|
169
|
+
gapX: 0, // horizontal offset
|
|
170
|
+
gapY: 0 // vertical offset
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
```js
|
|
177
|
+
wacom: {
|
|
178
|
+
ebpServiceUrl: //Service URL for the ebp translation service (only required for on-premise installations),
|
|
179
|
+
enableScreenSaver: //Enables the standby screen.
|
|
180
|
+
blackAndWhiteScreenSaver: //Project path where the black and white Wacom standby screen image is located.
|
|
181
|
+
colorScreenSaver: //Project path where the color Wacom standby screen image is located.
|
|
182
|
+
enableEbp: //Enables ebp in the project (display templates on Wacom).
|
|
183
|
+
enableInitialEbp: //Enables the pre-signature screen on Wacom.
|
|
184
|
+
varInitialEbp: //Template description that appears on the Wacom screen before signing. Separated by |||.
|
|
185
|
+
blackAndWhiteInitialEbp: //Project path where the black and white Wacom initial image is located.
|
|
186
|
+
colorInitialEbp: //Project path where the initial color image for Wacom is located.
|
|
187
|
+
varEbp: //Text values displayed in the EBP template for Wacom tablets at the time of signing. Variables are separated by three "|||" pipes.
|
|
188
|
+
|
|
189
|
+
},
|
|
190
|
+
```
|
|
191
|
+
Example: "**varEbp**": "Titulo=Título inicial|||Subtitulo=Subtítulo inicial|||Nombre=Edatalia|||TextoPrevio=Estoy de acuerdo con el documento a firmar",
|
|
192
|
+
## 📡 Events
|
|
193
|
+
|
|
194
|
+
WebSign emits events via the callback function passed as the third argument:
|
|
195
|
+
|
|
196
|
+
| Event | Description |
|
|
197
|
+
|-------|-------------|
|
|
198
|
+
| `signed` | Signature complete, PDF in `event.data` |
|
|
199
|
+
| `signed-multiple` | Signature complete for multiple PDF in `event.data` |
|
|
200
|
+
| `cancel` | User canceled the process |
|
|
201
|
+
| `error` | An error occurred |
|
|
202
|
+
| `no-device` | No Wacom device detected |
|
|
203
|
+
| `signature-timeout` | Timeout waiting for user input |
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 💻 DTU Integration
|
|
209
|
+
|
|
210
|
+
WebSign supports **Wacom DTU tablets** via a dedicated HTML file rendered on the device screen. You must provide the following parameters:
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
const config = {
|
|
214
|
+
signatureType: "dtu",
|
|
215
|
+
jsUrl: "/your/path/web-sign.js",
|
|
216
|
+
dtuHtmlUrl: "/your/path/dtu.html", // only needed in salesforce
|
|
217
|
+
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
> DTU signing is only supported in **Google Chrome**, **Edge**, and **Opera**.
|
|
222
|
+
|
|
223
|
+
## 🧾 License
|
|
224
|
+
|
|
225
|
+
© 2025 Edatalia Data Solutions. All rights reserved.
|
|
226
|
+
|
|
227
|
+
Web-Sign is proprietary software. Use of this library is permitted exclusively under the conditions set forth by Edatalia Data Solutions.
|
|
228
|
+
|
|
229
|
+
Terms of Use
|
|
230
|
+
This software may not be distributed, modified, or used without explicit permission from Edatalia Data Solutions.
|
|
231
|
+
|
|
232
|
+
Unauthorized redistribution is strictly prohibited.
|
|
233
|
+
|
|
234
|
+
For commercial licensing rights, please contact us at https://edatalia.com/contacto/.
|
|
63
235
|
|
|
236
|
+
Warranty and Liability
|
|
237
|
+
This software is provided "as is", without any warranties of any kind. Edatalia Data Solutions is not liable for any damages arising from the use of this software.
|
|
64
238
|
|
|
239
|
+
For more information or to acquire a commercial license, visit https://edatalia.com/.
|
|
65
240
|
|
|
241
|
+
---
|
|
66
242
|
|
|
243
|
+
## 🏢 About
|
|
67
244
|
|
|
245
|
+
Developed by [**Edatalia**](https://www.edatalia.com), digital signatures, and biometric solutions for secure document processing.
|
package/favicon.ico
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edatalia-websign",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "JavaScript library for handwritten digital signatures from a web browser and/or using Wacom STU and DTU tablets.",
|
|
5
5
|
"main": "web-sign-core.js",
|
|
6
6
|
"files": [
|
|
7
|
-
"web-sign-core.js"
|
|
7
|
+
"web-sign-core.js",
|
|
8
|
+
"favicon.ico"
|
|
8
9
|
],
|
|
9
10
|
"scripts": {
|
|
10
11
|
"test": "jest",
|
|
11
12
|
"build:core": "cross-env BUILD_TARGET=core rollup -c",
|
|
12
13
|
"build:full": "cross-env BUILD_TARGET=full rollup -c",
|
|
13
|
-
"build:all": "node postbuild.mjs"
|
|
14
|
+
"build:all": "node postbuild.mjs",
|
|
15
|
+
"publish:core-win": "npm run build:core && copy dist\\web-sign-core.js web-sign-core.js && npm publish --access public && del web-sign-core.js",
|
|
16
|
+
"publish:core-mac": "npm run build:core && cp dist/web-sign-core.js web-sign-core.js && npm publish --access public && rm -f web-sign-core.js"
|
|
17
|
+
|
|
18
|
+
|
|
14
19
|
},
|
|
15
20
|
"keywords": [],
|
|
16
21
|
"author": "edatalia data solutions",
|
|
17
|
-
"license": "
|
|
22
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
18
23
|
"private": false,
|
|
19
24
|
"devDependencies": {
|
|
20
25
|
"@babel/preset-env": "^7.26.9",
|