Use Visualforce Page as PDF for Signing Document
Wednesday, August 19, 2020 at 08:43amI am attmepting to use a VisualForce page that was created as the template for the signing document. I added the text tags: {{esl:SellerSign1:Signature1,size(80,20)}}
{{esl:SellerSign1:Autofield1:SigningDate1,size(80,20)}}
{{esl:SellerSign1:InputField2:TextField2,size(80,20)}}
{{esl:BuyerSign1:Signature2,size(80,20)}}
{{esl:BuyerSign1:Autofield2:SigningDate2,size(80,20)}}
{{esl:BuyerSign1:InputField3:TextField3,size(80,20)}}
Those are inside of the visualforce component.
In my queueable class, i am using PageReference pr = PageReference('/apex/OrderPDF?id=' + orderId);
When I use the sdk.createPackage(pkg,documentBlobMap); method. I get a 303 Error - See Other response. And I can't figure out what is wrong.
I have attached the portion of the pdf that shows the text tags.
Reply to: Use Visualforce Page as PDF for Signing Document
Wednesday, August 19, 2020 at 08:46amSorry, I left a line out.
After creating the PageReference pr = ....
I use an Apex method pr.getContent() to get the pdf from the page as a blob. That blob is what is sent through to the sdk.CreatePackage.
Reply to: Use Visualforce Page as PDF for Signing Document
Wednesday, August 19, 2020 at 10:06amHi Douglas,
For the first glance, there seems some syntax error in your text tags (guide here):
{{esl:SellerSign1:Signature1,size(80,20)}} -------------------> {{esl:SellerSign1:Signature:size(80,20)}}
{{esl:SellerSign1:Autofield1:SigningDate1,size(80,20)}} -------------------> {{esl:SellerSign1:SigningDate:size(80,20)}}
{{esl:SellerSign1:InputField2:TextField2,size(80,20)}} -------------------> {{esl:SellerSign1:TextField:size(80,20)}}
On top of that, although I am not good at Salesforce developing, below are some of my thoughts:
(1)303 error seems not returned from OneSpan Sign system, which makes me think it may derived from local SDK code
(2)could you save the visualforce page in PDF locally, then reference the static resource in the SDK code?
(3)could we make sure the visualforce is rendered in PDF instead of HTML format?
(4)don't forget to make sure the role name matches the text tags:
ESignLiveAPIObjects.Role role = new ESignLiveAPIObjects.Role();
role.id = 'SellerSign1';
role.name = 'SellerSign1';
role.signers = sdk.createRolesSigner('John', 'Smith', '[email protected]', 'CEO', 'ABC Bank');
Duo
Reply to: Hi Douglas, For the…
Wednesday, August 19, 2020 at 10:54amHi Duo_Liang, thanks for getting back to me. I updated the text tags. Thanks for finding that.
1 - Error 303 - See OTeher is the response I get back fomr the Apex SDK OneSpanRestAPIHelper.doPost(String resourceUrl, Blob requestBody) method.
- I'm pretty sure its coming back from OneSpan.
2 - I cannot use a static resource because the visualforce page has some dynamic content rendered inside of it and we can't get the same level of automation through the AutoFields, as far as I can tell.
3- Visualforce page is being rendered as pdf.
4- role name matches the text tags.
I'm using the apex sdk unmanaged package, and the error is thrown from the OneSpanRestAPIHelper.doPost(String resourceUrl, Blob requestBody)
The call stack would be:
OneSpanRestAPIHelper.doPost(String resourceUrl, Blob requestBody)
OneSpanRestAPIHelper.createPackageWithBinaries(Blob multipartFormData)
OneSpanSDK.createPackageWithBinaries(OneSpanAPIObjects.Package_x pkg, Map<String,Blob> documentMap)
OneSpanSDK.public String createPackage(OneSpanAPIObjects.Package_x pkg, Map<String,Blob> documentBlobMap)
which is being called from my code where I create the Pagereference as a pdf and pass it along with the package into that method.
I changed the code to create the package first and then use the package to create the document, and the package is successfully created, but the document fails.
Attached is the code for creating the roles, and the code for creating the package, and the pdf that was generated and sent through the SDK to OneSpan.
Reply to: Use Visualforce Page as PDF for Signing Document
Wednesday, August 19, 2020 at 11:15amI made some changes, and I don't know what other changes I made, but I am finally able to successfully create the package and document. Once the document is created does that automatically send an email to the signers?
Reply to: Use Visualforce Page as PDF for Signing Document
Wednesday, August 19, 2020 at 11:25amGood to hear it's working! The activation email will only be sent when package status changed to "SENT":
//Create package
ESignLiveAPIObjects.Package_x pkg = new ESignLiveAPIObjects.Package_x();
......
//Send package
pkg.status = ESignLiveAPIObjects.PackageStatus.SENT;
sdk.updatePackage(pkg, packageId);
Duo
Reply to: Use Visualforce Page as PDF for Signing Document
Wednesday, August 19, 2020 at 11:31amIt doesn't seem to recognize the text tags. I had to add a signature in from the onespansign dashboard @ sandbox.esignlive.com
Here is what it looked like when I got the email before i signed, notice I added the tags in through the UI on EsignLive website, but the date and name fields still show the text tags.
Reply to: It doesn't seem to recognize…
Wednesday, August 19, 2020 at 12:43pmDuo_Lingo
I'm definitely missing some pieces here. If I add the text tags into the pdf, do I still need to add some code for the approvals or signature fields when I'm creating the package?
I have attached the relevant code for the pdf and the code that I am using to create the package and document. Sorry for so many back and forth's, I just feel like I've almost got this finished and hoping to finish it in the next few days
Reply to: Use Visualforce Page as PDF for Signing Document
Wednesday, August 19, 2020 at 01:06pmHi Douglas,
It seems you haven't tweaked the text tags, see my reply above:
{{esl:SellerSign1:Signature1,size(80,20)}} -------------------> {{esl:SellerSign1:Signature:size(80,20)}}
{{esl:SellerSign1:Autofield1:SigningDate1,size(80,20)}} -------------------> {{esl:SellerSign1:SigningDate:size(80,20)}}
{{esl:SellerSign1:InputField2:TextField2,size(80,20)}} -------------------> {{esl:SellerSign1:TextField:size(80,20)}}
Duo
Reply to: Hi Douglas, It seems you…
Wednesday, August 19, 2020 at 02:06pmSorry I thought I had added the updated html, that was the old stuff. I fixed the comma and semi colon, and changed some of the size values. Please check this one
Reply to: Use Visualforce Page as PDF for Signing Document
Thursday, August 20, 2020 at 08:24amHi Douglas,
Thanks for the updates, there are still few places to change in the tags:
{{esl:SellerSign1:Signature2:size(60,20)}} -------------------> {{esl:SellerSign1:Signature:size(80,20)}}
"Signature" is a reserved type, can't be followed by an index
{{esl:SellerSign1:Autofield1:SigningDate1:size(30,20)}} -------------------> {{esl:SellerSign1:SigningDate:size(80,20)}}
"SigningDate" is reserved, "Autofield1" should be omitted
{{esl:SellerSign1:InputField2:TextField2:size(80,20)}} -------------------> {{esl:SellerSign1:TextField:size(80,20)}}
"TextField" is reserved, "InputField2" should be omitted
If you want to give the field a field name, add an underscore with the name after "esl":
{{esl_SellerSignature1:SellerSign1:Signature:size(80,20)}}
Duo