0

我正在创建一个通用微服务,它接受 PDF 并通过电子邮件发送给多个签名者进行签名。

我正在尝试在签名者需要签名的 PDF 字段上放置黄色框(选项卡)。似乎有3种方法可以做到这一点:

  1. x, y坐标(不适合该项目,因为要求调用程序测量 PDF 以提供该坐标并不容易)
  2. anchorString, 不理想,因为不建议在 PDF 上进行编辑
  3. CompositeTemplate似乎是唯一的出路。不知道做错了什么,那个黄色标签不会显示。

        byte[] buffer = readFile( docPdf);
        String docBase64 = Base64.getEncoder().encodeToString(buffer);
    
        // Create the DocuSign document object
        Document document = new Document();
        document.setDocumentBase64(docBase64);
        document.setName(docPdf); 
        // can be different from actual file name
        document.setFileExtension("pdf");
        document.setTransformPdfFields("true");
        // many different document types are accepted
        document.setDocumentId("1"); 
        // a label used to reference the doc
    
    
        ArrayList<CompositeTemplate> compList = new ArrayList<CompositeTemplate>();
        CompositeTemplate compoTemplate = new CompositeTemplate();
    
           //Add to Composite template
        compoTemplate.setDocument(document);
    
        //Create Envelope recipients, including them in the first template
        ArrayList<Signer> signers= new ArrayList<Signer>();
    
        Signer signer1 = new Signer ();
        signer1.setEmail("***@***");
        signer1.setName("Jane Doe");
        signer1.setRecipientId("1");
        signer1.setRoleName("Test");
        signer1.setRoutingOrder("1");
    
    
        SignHere signHere1 = new SignHere();
        signHere1.setTabLabel("aaa");
        signHere1.setRecipientId("1");
        signHere1.setDocumentId("1");
        signHere1.setPageNumber("6");
    
        Tabs recipientTabs = new Tabs();
        recipientTabs.setSignHereTabs(Arrays.asList(signHere1));
    
        signer1.setTabs(recipientTabs);
    
        signers.add(signer1);
    
        Recipients recipientList = new Recipients();
        recipientList.signers(signers);
    
        //Create the list for InlineTemplates
    
    
        ArrayList<InlineTemplate> inlineTemplateList = new ArrayList<InlineTemplate>();
        InlineTemplate inlineTemplate = new InlineTemplate();
        inlineTemplate.setSequence ( "1");
        inlineTemplate.setRecipients(recipientList);
    
        inlineTemplateList.add(inlineTemplate);
    
        //Create the composite template, inline template lists.
        compoTemplate.setCompositeTemplateId("1");
        //compoTemplate.ServerTemplates = templateList;
        compoTemplate.setInlineTemplates(inlineTemplateList);
    
        //Take the Composite Template list, add both 
    
        compList.add(compoTemplate);
    
        //Create the definition for the envelope
        EnvelopeDefinition  envelopeDefinition = new EnvelopeDefinition();
        //Add the Composite Template list
       // envelopeDefinition.setCompositeTemplates(templateList);
        envelopeDefinition.setEmailSubject("composite ***** ");
        envelopeDefinition.setCompositeTemplates(Arrays.asList(compoTemplate));
      //  envelopeDefinition.setRecipients(recipientList);
    
        envelopeDefinition.setStatus("sent"); // requests that the envelope be created and sent.
    
4

1 回答 1

0

请参阅有关选项卡的文档中的此注释(https://developers.docusign.com/esign-rest-api/guides/concepts/tabs):

重要提示:PDF 字段的名称必须与您希望将值传输到的 DocuSign 选项卡的(区分大小写)tabLabel 值匹配。如果 PDF 字段名称与 DocuSign tabLabel 匹配,您可以将文档数组中给定文档的 transformPdfFields 属性设置为 true,如下所示。

(我在您的代码中没有看到 tabLabel 属性)

于 2019-07-06T00:28:55.663 回答