-
Notifications
You must be signed in to change notification settings - Fork 17
/
create_document.js
executable file
·56 lines (47 loc) · 1.58 KB
/
create_document.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'use strict';
var Client = require('../index').Client;
var Recipient = require('../index').Recipient;
var Signer = require('../index').Signer;
var Document = require('../index').Document;
var File = require('../index').File;
var SignatureField = require('../index').SignatureField;
var config = require('./config');
var client = new Client(config.accessKey, config.businessId);
var document = new Document();
// document.setSandbox(true);
document.setTitle("Title goes here");
document.setRequesterEmail("[email protected]");
document.setIsDraft(false);
document.setRedirect('https://eversign.com/?success');
document.setRedirectDecline('https://eversign.com/?declined');
document.setCustomRequesterName('Joe Requester');
document.setCustomRequesterName('[email protected]');
document.setUseHiddenTags(true);
var recipient = new Recipient();
recipient.setName("Tester Test");
recipient.setEmail("[email protected]");
recipient.setRole(null);
document.appendRecipient(recipient);
var signer = new Signer();
signer.setName('Tester Test');
signer.setEmail(config.signerEmail)
document.appendSigner(signer);
var file = new File({
name: 'My File',
filePath: __dirname + '/raw.pdf',
});
document.appendFile(file);
var signatureField = new SignatureField();
signatureField.setFileIndex(0);
signatureField.setPage(1);
signatureField.setX(30);
signatureField.setY(150);
signatureField.setRequired(true);
signatureField.setSigner("1");
document.appendFormField(signatureField);
client.createDocument(document).then(function(doc) {
console.log(doc.getDocumentHash());
})
.catch(function(err) {
console.log(err);
})