@sajn/embed package provides two ways to embed the signing experience: a function API and a Web Component.
Installation
npm
CDN
For projects without a build step, use the UMD bundle:sajn global object with all exports.
Function API
TheembedSignDocument function creates an iframe and handles all communication with the embedded signing interface.
Import
Options Interface
Return Type
Example
Web Component
The package also exports a custom element<sajn-sign-document> that auto-registers when imported.
Import
Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
document-id | string | Yes | Document ID |
token | string | Yes | Signer token |
host | string | No | Custom host URL |
language | string | No | UI language (sv, en, no, da, fi, de, is, es, fr, it) |
class-name | string | No | CSS class for iframe |
allow-document-rejection | boolean | No | Enable rejection |
show-scroll-indicator | boolean | No | Show scroll indicator (default: true) |
Events
The Web Component dispatches standardCustomEvents that you can listen to:
| Event | Detail |
|---|---|
document-ready | undefined |
signer-completed | SignerCompletedData |
signer-rejected | SignerRejectedData |
document-error | DocumentErrorData |
Example
CDN Usage Example
Complete HTML page using the UMD bundle:TypeScript Types
The package exports all types for TypeScript users:View Component
The package also includesembedViewDocument for displaying signed documents in read-only mode.
Function API
Options Interface
Example
Web Component
The package also exports a custom element<sajn-view-document>:

