Copy const apiToken : string = "YOUR TOKEN" ;
Copy const fromToTemplateName : DeParaTemplateBuilder = deParaTemplateBuilder ()
.de ( "{{FULL NAME}}" ) // the variable
.para ( "Jhon Doe" ) // the value to replace
.build ();
const fromToTemplateSocialSecurty : DeParaTemplateBuilder = deParaTemplateBuilder ()
.de ( "{{Social Security Number}}" )
.para ( "9999999999" )
.build ();
const fromToTemplateAdress : DeParaTemplateBuilder = deParaTemplateBuilder ()
.de ( "{{Full address}}" )
.para ( "999 N Main St" )
.build ();
let fromToTemplates : DeParaTemplatesBuilder [] = [];
fromToTemplates .push (fromToTemplateName , fromToTemplateSocialSecurty , fromToTemplateAdress);
Copy const docFromTemplate : DocFomTemplateBuilder = new DocFromTemplateBuilder ()
.withSandbox ( false )
.withPrimaryColor ( "#000000" )
.withSignerName ( "My Signer for Template" )
.withTemplateId ( "YOUR TEMPLATE ID" )
.withData (fromToTemplates)
.build ();
Copy async function exempleCreateDocFromTemplate () {
try {
docResponse : DocResponse = await new DocRequests (apiToken) .createDocFromTemplateAsync (docFromTemplate);
jsonDocResponse : string = new JsonConverter () .docAsyncResponseToJson (docResponse);
console .log (jsonDocResponse);
} catch (Err) {
console .log (Err);
}
}
Copy import { DeParaTemplateBuilder } from "sdk-node-typescript-zapsign/src/body/doc/builders/DeParaTemplateBuilder" ;
import DocRequests from "sdk-node-typescript-zapsign/src/docs/DocRequests" ;
import { JsonConverter } from "sdk-node-typescript-zapsign/src/services/JsonConverter" ;
import { DocFromTemplate } from "sdk-node-typescript-zapsign/src/body/doc/builders/DocFromTemplate" ;
const apiToken : string = "YOUR TOKEN" ;
const fromToTemplateName : DeParaTemplateBuilder = DeParaTemplateBuilder ()
.de ( "{{Full Name}}" )
.para ( "Jhon Doe" )
.build ();
const fromToTemplateCpf : DeParaTemplateBuilder = DeParaTemplateBuilder ()
.de ( "{{Social Security Number}}" )
.para ( "9999999999" )
.build ();
const fromToTemplateEndereco : DeParaTemplateBuilder = DeParaTemplateBuilder ()
.de ( "{{Full address}}" )
.para ( "999 N Main St" )
.build ();
let fromToTemplates : DeParaTemplatesBuilder [] = [];
fromToTemplates .push (fromToTemplateName , fromToTemplateCpf , fromToTemplateEndereco);
const docFromTemplate : DocFomTemplateBuilder = new DocFromTemplateBuilder ()
.withSandbox ( false )
.withPrimaryColor ( "#000000" )
.withSignerName ( "My Signer for Template" )
.withTemplateId ( "YOUR TEMPLATE ID" )
.withData (fromToTemplates)
.build ();
async function exempleCreateDocFromTemplate () {
try {
docResponse : DocResponse = await new DocRequests (apiToken) .createDocFromTemplate (docFromTemplate);
jsonDocResponse : string = new JsonConverter () .docAsyncResponseToJson (docResponse);
console .log (jsonDocResponse);
} catch (Err) {
console .log (Err);
}
}