dmaxfield

Use Visualforce Page as PDF for Signing Document

0 votes

I 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

0 votes

Sorry, 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

0 votes

Hi 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

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to:

0 votes

Hi 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

0 votes

I 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

0 votes

Good 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

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Use Visualforce Page as PDF for Signing Document

0 votes

It 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. 


Attachments

Reply to:

0 votes

Duo_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

 


Attachments

Reply to: Use Visualforce Page as PDF for Signing Document

0 votes

Hi 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

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Use Visualforce Page as PDF for Signing Document

0 votes

Hi 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

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off