0

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

1 回答 1

0

如果没有看到您的文档,就很难调试您看到的问题。您可以进一步调试的一种方法是使用邮递员并使用以下 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"

}

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

于 2020-12-16T23:07:06.977 回答