【问题标题】:How to apply template setAnchorXOffset when you create an envelope from a template?从模板创建信封时如何应用模板 setAnchorXOffset?
【发布时间】:2021-03-26 21:38:04
【问题描述】:

我使用了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;
}

【问题讨论】:

    标签: docusignapi e-signature


    【解决方案1】:

    没有看到您的文档,就很难调试您看到的问题。您可以进一步调试的一种方法是使用邮递员并使用以下 JSON 来尝试查看是否可以让它们工作:

    端点:https://demo.docusign.net/restapi/v2.1/accounts/xxxx/envelopes

    {
        {
            "document": {
                "documentBase64": ".........", << provide your document here
                "documentId": "1",
                "name": "Letter"
            },
            "inlineTemplates": [
                {
                    "recipients": {
                        "signers": [
                            {
                                "email": "randomtester2@xxxx.com",
                                "name": "Random Tester2",
                                "recipientId": "1",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "anchorString": "November",
                                            "anchorUnits": "pixels",
                                            "anchorXOffset": "20",
                                            "anchorYOffset": "10"
                                        }
                                    ]
                                }
                            }
                        ]
                    },
                    "sequence": "4"
                }
            ]
        }
    ],
    "emailSubject": "Test",
    "expireAfter": "2",
    "expireEnabled": "true",
    "status": "sent"
    

    }

    看看你是否可以这样应用偏移量。这应该可以澄清可能出现的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      相关资源
      最近更新 更多