gurvinder

Performance improvement

0 votes
Hi There, In our application, I am using the code below to get the documents eSigned Automatically in the sandbox account. There are two documents that needs to be signed and each document is only 70-100kb in size, but the signing process takes about 7~8 seconds to complete the signing. This is something we are doing on post action of a page and this makes the next page load a lot slower. Is there anything that I can change in my code that can improve the performance? Or will the performance be automatically faster in production account?
            Stream file1 = new MemoryStream(Document1);
            EslClient eslClient = new EslClient(API_KEY, API_URL);

            PackageBuilder packageToBuild = PackageBuilder.NewPackageNamed("Test package");

            Signer signer1 = SignerBuilder.NewSignerWithEmail(Signer1Details.SignerDetails.ssSignerEmail)
                                                 .WithCustomId(Signer1Details.SignerDetails.ssSignerId)
                                                 .WithFirstName(Signer1Details.SignerDetails.ssFirstName)
                                                 .WithLastName(Signer1Details.SignerDetails.ssLastName)
                                                 .Build();

            

            DocumentBuilder document = DocumentBuilder.NewDocumentNamed(Document1Name)
                                                      .FromStream(file1, DocumentType.PDF)
                                                      .WithId(Doc1Id)
                                                      .WithSignature(SignatureBuilder.SignatureFor(Signer1Details.SignerDetails.ssSignerEmail)
                                                              .OnPage(PageToSign)
                                                              .AtPosition(SignatureXPosition, SignatureYPosition)
                                                              .WithField(FieldBuilder.SignatureDate()
                                                                       .OnPage(0)
                                                                       .AtPosition(SignatureXPosition, (SignatureYPosition + 50))));
            DocumentPackage packageToSend;
            PackageId packageId;
            if (ssTotalDocuments == 2)
            {
                Stream file2 = new MemoryStream(ssDocument2);

                Signer signer2 = SignerBuilder.NewSignerWithEmail(Signer2Details.SignerDetails.ssSignerEmail)
                                                 .WithCustomId(Signer2Details.SignerDetails.ssSignerId)
                                                 .WithFirstName(Signer2Details.SignerDetails.ssFirstName)
                                                 .WithLastName(Signer2Details.SignerDetails.ssLastName)
                                                 .Build();

                DocumentBuilder document2 = DocumentBuilder.NewDocumentNamed(Document2Name)
                                                           .FromStream(file2, DocumentType.PDF)
                                                           .WithId(Doc2Id)
                                                           .WithSignature(SignatureBuilder.SignatureFor(ssSigner2Details.ssSTSignerDetails.ssSignerEmail)
                                                                    .OnPage(PageToSign)
                                                                    .AtPosition(SignatureXPosition, SignatureYPosition)
                                                                    .WithField(FieldBuilder.SignatureDate()
                                                                              .OnPage(0)
                                                                              .AtPosition(SignatureXPosition, (SignatureYPosition + 50))));

                packageToSend = packageToBuild.WithSigner(signer1).WithSigner(signer2).WithDocument(document).WithDocument(document2).Build();
                packageId = eslClient.CreateAndSendPackage(packageToSend);
                eslClient.SignDocuments(packageId, signer1.Id);
                eslClient.SignDocuments(packageId, signer2.Id);
            }
            else
            {
                packageToSend = packageToBuild.WithSigner(signer1).WithDocument(document).Build();
                packageId = eslClient.CreateAndSendPackage(packageToSend);
                eslClient.SignDocuments(packageId, signer1.Id);
            }

            

            PackageId = packageId.ToString();

Approved Answer

Reply to: Performance improvement

0 votes
Hi Gurvinder, You will definitely notice a performance improvement once you switch to production. Unfortunately, there isn't much you can do in terms of optimizing your code because the SDK performs additional calls, which you can see if you're using a tool like Fiddler.
Haris Haidary OneSpan Technical Consultant

Reply to: Performance improvement

0 votes
Hi Haris, I can do something like: Create different packages for each document, run them on different threads (each thread has its own ESL client). This makes the task to be completed in about 4~5 seconds. It is fine by us for each document to have it's own package but I was wondering if I can do something combine those two packages?

Reply to: Performance improvement

0 votes
Unfortunately, you cannot merge packages.
Haris Haidary OneSpan Technical Consultant

Reply to: Performance improvement

0 votes
Hi Gurvinder, Did programmatic signing work for you? I ask because I am getting an exception when I am trying to use eslClient.SignDocuments(PackageID, SignerId). Thanks Jay

Reply to: Performance improvement

0 votes
Jay, The cloud application is currently on version 11.5 where as the FedRamp instance (the one you're currently on) is on 10.9 I believe. You will be able to make the signDocuments() once FedFramp is upgraded to version 11.
Haris Haidary OneSpan Technical Consultant

Reply to: Performance improvement

0 votes
Hi Haris, We've tested this further and this is what we've found The auto signing works when we use the api key of a sender and the sender is also the signer Ideally we want to use the account owner's api key and when the account owner is not necessarily the signer can you check on this please? thanks Neel & Jay

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