robadmiraal

How do I set the FromFile option on a capture field

0 votes

What parameter can I use on a capture tag, to set the fromfile value to true.

I cannot find it anywhere. This is what I've tried, but it is not a valid parameter:

{{esl:signer1:capture:size(200,50),fromfile(true)}}

Or is there a way that I can modify all capture fields in a new package using the .NET SDK with text extraction, to use the SetFromFile(true) method, without knowing the names of the capture fields in the document?

Thanks in advance. 

 

 

 


Approved Answer

Reply to: How do I set the FromFile option on a capture field

1 votes

Found the problem that caused the error. In the sandbox environment I had to call "WithHandOverLinkHref" on the DocumentPackageSettingsBuilder with a URL.


Reply to: How do I set the FromFile option on a capture field

0 votes

Hi robadmiraal,

 

Thanks for your post!

Yes, I believe fromfile is not yet supported by text tags. Therefore, try to update the signatures in a separate step:

 

            DocumentPackage documentPackage = PackageBuilder.NewPackageNamed("Test FromFile")
                             .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                                           .WithCustomId("Signer1")
                                           .WithFirstName("John")
                                           .WithLastName("Smith"))
                             .WithDocument(DocumentBuilder.NewDocumentNamed("Document1")
                                     .WithId("Document1")
                                     .FromFile("C:\\Users\\liangdu1\\Desktop\\work\\documents\\demo docs\\4B-CarLoan.pdf")
                                     .WithSignature(SignatureBuilder.CaptureFor("[email protected]")
                                         .OnPage(0)
                                         .AtPosition(100, 140)
                                      )
                                    .WithSignature(SignatureBuilder.CaptureFor("[email protected]")
                                         .OnPage(0)
                                         .AtPosition(100, 240)
                                      )
                                    .WithSignature(SignatureBuilder.CaptureFor("[email protected]")
                                         .OnPage(0)
                                         .AtPosition(100, 340)
                                      )
                              )
                              .Build();

            PackageId packageId = ossClient.CreatePackageOneStep(documentPackage);


            DocumentPackage createdPackage = ossClient.GetPackage(packageId);
            foreach (var doc in createdPackage.Documents)
            {
                if (doc.Id == "Document1")
                {
                    List<Signature> captureSignatures = new List<Signature>();
                    foreach (var signature in doc.Signatures)
                    {
                        if (signature.Style == SignatureStyle.HAND_DRAWN)
                        {
                            signature.FromFile = true;
                            captureSignatures.Add(signature);
                        }
                    }

                    if (captureSignatures.Count > 0)
                    {
                        ossClient.ApprovalService.UpdateApprovals(createdPackage, doc.Id, captureSignatures);
                    }
                }
            }

            ossClient.SendPackage(packageId);
            Debug.WriteLine(packageId);

 

Let me know how this works for you.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: How do I set the FromFile option on a capture field

1 votes

Thank you very much for this solution. Unfortunately I get an error on this line:

DocumentPackage createdPackage = ossClient.GetPackage(packageId);

The error is: :

OneSpanSign.Sdk.OssException: 'href cannot be null or an empty string'

packageId is filled and the package is created.

The baseURI on the ossCLient is "https://sandbox.esignlive.com/api". Can you help me with this?

 


Reply to: How do I set the FromFile option on a capture field

0 votes

The problem only occurs in the sandbox. In the live API it works well.

Another thing in your example code is that it includes this line:

ossClient.SendPackage(packageId);

Causing the package to be sent out immediately. I've changed it to:

ossClient.UpdatePackage(packageId, createdPackage);

So the package is only updated and not send to the signers.


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