我使用了 docusign-design-java-2.15.0 SDK。
我制作了一个模板并使用了 SETANCHOR API。当我使用模板制作信封时,未应用 setAnchorXOffset 或 setAnchorYOffset。
创建模板代码
public Map<String,Object> createTemplate(Map<String,Object> tempInfo, Map<String,Object> buyerInfo, List<Map<String,Object>> supplierList, List<DocumentMgt> documentMgtList){
Map<String,Object> result = new HashMap<String,Object>();
TemplatesApi templatesApi = new TemplatesApi();
EnvelopeTemplate envelopeTemplate = new EnvelopeTemplate();
String templateName = (String)tempInfo.get("template_name");
result.put(Const.RESULT_STATUS, Const.SUCCESS);
int supplierSignOrder = 0;
try {
List<Signer> signerList = new ArrayList<Signer>();
Signer bpSigner = new Signer();
String bpRecipientId = UUID.randomUUID().toString();
String bpClientUserId = UUID.randomUUID().toString();
String bpAnchorString = (String)tempInfo.get("bp_sign_anchor_name");
String bpSignDocumentId = (String)tempInfo.get("bp_sign_document_id");
String bpEmail = (String)tempInfo.get("bp_email");
SignHere signHere = makeSignHere(bpAnchorString, bpSignDocumentId, bpRecipientId);
List<SignHere> signHereTabs = new ArrayList<SignHere>();
signHereTabs.add(signHere);
....
......
}
锚函数
public SignHere makeSignHere(String anchorString, String documentId, String recipientId) {
SignHere signHere = new SignHere();
signHere.setDocumentId(documentId);
signHere.setRecipientId(recipientId);
signHere.setAnchorString(anchorString);
signHere.setScaleValue("170");
signHere.setAnchorXOffset("-100");
signHere.setAnchorYOffset("-10");
return signHere;
}
创建信封代码
public Map<String,Object> createEnvelope(Map<String,Object> templateInfo){
Map<String,Object> result = new HashMap<String,Object>();
result.put(Const.RESULT_STATUS, Const.SUCCESS);
EnvelopeDefinition envDef = new EnvelopeDefinition();
String templateId = (String)templateInfo.get("template_id");
envDef.setTemplateId(templateId);
String emailSubject = (String)templateInfo.get("title");
envDef.setEmailSubject(emailSubject);
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary;
String docusignstatus = (String)templateInfo.get("docusign_status");
envDef.setStatus(docusignstatus);
try {
envelopeSummary = envelopesApi.createEnvelope(accountId, envDef);
} catch (ApiException e) {
LOG.error("ERROR : " + e.toString());
}
return result;
}