Create Package from template and adding another document to sign
Thursday, June 17, 2021 at 07:57pmHi!
I have some templates that define some pdf file to be filled and signed over the OSS Session.
For all of the created transaction, we are also creating a custom pdf that needs to be signed by the same Signer.
I've seen the other forum topic and I'm being able to create the package from templates, add the second file, but here is the issue: The second file cant be signed. Also, can't find a way to order the documents to be signed.
Is that posible?
Thanks in advance.
Reply to: Create Package from template and adding another document to sign
Friday, June 18, 2021 at 09:05amHi rodrigo.carmona,
Yes, it's completely possible to create a package out of a template, then add an additional document, see below sample code:
EslClient eslClient = new EslClient(API_KEY, API_URL);
//Step1: create package out of template
DocumentPackage newPackage = newPackageNamed("Create Package from Template")
.withSigner(newSignerWithEmail("[email protected]")
.withFirstName("signer1 first name")
.withLastName("signer1 second name")
.replacing(new Placeholder("28f93502-8b47-4702-b530-e3bdc2911d52")))
.build();
PackageId createPackageFromTemplate = eslClient.getTemplateService()
.createPackageFromTemplate(new PackageId("Ox49l0Ne6UYBF0gs1GmQyGM8MqM="), newPackage);
//Step2: add a new document
Document document = DocumentBuilder.newDocumentWithName("Document1")
.fromFile("path_to_doc")
.withId("Document2")
.withSignature(SignatureBuilder.signatureFor("[email protected]")
.onPage(0)
.atPosition(100, 100)
.withSize(200, 55))
.build();
eslClient.uploadDocument(document, createPackageFromTemplate);
//Step3: send the package
eslClient.sendPackage(createPackageFromTemplate);
You can compare your existing code with above code snippet, also, could you share the template ID and a package ID where your signer can't sign, so that I can look closer into your issue?
Duo
Reply to: Hi rodrigo.carmona, Yes,…
Friday, June 18, 2021 at 09:37amHi Duo!
The main difference between your snippet and my actual code it's I was creating the DocumentPackage like this:
Then:
The document that I'm uploading it's created on the app like this (from a file):
The signer is created like this:
And has this to locate the signature for the Signer:
Maybe I need to change the order or to modify my custom document creation.
Not all the use cases have to use the template.
------
The transaction that I've used is on the sandbox:
TemplateID: Ug_EIC8CCV8md-Jc7PJCHkEnrx0=
PackageID: SouOnYztjTy2RvoD6n_TPh2gPKA=
Thanks for your response.
Reply to: Create Package from template and adding another document to sign
Friday, June 18, 2021 at 12:25pmHi rodrigo.carmona,
Thanks for the information, I see the reason why it happens to you. First I'd like to clarify the nature of the issue a bit:
In your template, your placeholder has role ID "901da53c-9bd8-43ff-8b63-460a5cccd95f", role Name "Signer1"
However after creating package out of this template, the Java SDK replaces all of the role ID, role Name, signer ID to "901da53c-9bd8-43ff-8b63-460a5cccd95f"
While your text tags {{esl:Signer1:Signature:size(200,50),offset(0,-20)}} is exclusively looking for Signer with role Name of "Signer1", that's why it doesn't get extracted.
Because it's a drawback of SDK that it can't explicitly set role name, I would suggest you to change the placeholder's role ID to "Signer1" as well, in which case I believe it will solve the issue. To notice, placeholders added via sender UI will have this UUID format role ID, while the placeholders added via Java SDK will have the same role ID and role Name:
eslClient.getPackageService().addSigner(templateId, SignerBuilder.newSignerPlaceholder(new Placeholder("Signer1")).build());
If it's possible, you can create another template through UI, add the placeholder through SDK, and finish up the rest of the design back in UI. And unfortunately you may have to follow this process every time for your subsequent templates due to the role ID and Name inconsistency.
Duo
Reply to: Create Package from template and adding another document to sign
Friday, June 18, 2021 at 02:32pmOh! but it's good news then if I can use the Signer1 as the placeholder.
I will try this and get back to you with any news.
Thanks Duo!
Reply to: Create Package from template and adding another document to sign
Monday, July 5, 2021 at 06:07pmHi Duo!
I've do this and it's work. I was strugling a bit because I was misunderstanding this but happens to work. You can see it here in this transaction: dJU2HhLmJuzRKtrtgQybs1s5uBo=.
Now, I know there the SDK have a method to download all signed docs. Exists anyway to loop over it, one by one?
Thanks in advance.