Kosta | Posts: 10

How to validate if a document holds required text-anchor?

0 votes
Hello Team, I have the following scenario: I am trying to create a Package with a PDF document, which is provided as binary stream. I also want to add a Signer(s) Signature(s) and to locate these through corresponding text-anchors. In case when the required text-anchors are not available in th ePDF document I get the following Error:
com.silanis.esl.sdk.internal.EslServerException: Could not upload document to package. 

Exception: HTTP POST on URI https://sandbox.esignlive.com/packages/qYSDX1Frsvn5-T-F8Hg39g5fWm4=/documents 
resulted in response with status code: [400, Bad Request]. 

Optional details: 
{
	"messageKey":"error.validation.verifyDocument.couldNotBeFlattened",
	"message":"Could not upload PDF document: it contains a syntax error preventing proper processing of its data.",
	"code":400,
	"name":"Validation Error"
}
which then results in my Package created and in DRAFT State and this outcome is not required. My question is: Is there a functionality in the SDK where I could validate if the required text-anchor is present in the provided PDF binary stream, before I send the EslClient - "Create&Send" call? Thank you very much.

Approved Answer
harishaidary | Posts: 1812

Reply to: How to validate if a document holds required text-anchor?

1 votes
Hi, Unfortunately, there is no way to pre-validate if a text is present using the Java SDK. You will have to use an external library to search through your PDF to make the check. Here's one example using PdfBox and Apache Lucene: http://hello-world-2-0.blogspot.ca/2008/03/java-library-to-search-in-pdf-files_12.html

Kosta | Posts: 10

Reply to: How to validate if a document holds required text-anchor?

0 votes
Hello Haris, Thank you very much fore the update. I think it would be handy if we could have some sort of PackageDocument pre-validation before we call eslClient Create Package. For example:
try {
   eslClient.validatePackageDocument();
} catch (EslException e) {
   //ECHO there was problem with Package set up!!!
   System.out.println(e.getMessage());
}
In the mean time I will check the provided URL . Regards, Kosta.

harishaidary | Posts: 1812

Reply to: How to validate if a document holds required text-anchor?

1 votes
I definitely agree with you, it would indeed be very handy. You can make a request for this in our Enhancement Ideas forum. Our product managers regularly follow this forum for new ideas coming from customers.

Kosta | Posts: 10

Reply to: How to validate if a document holds required text-anchor?

0 votes
Hello Haris, could you please check the raised enhancement suggestion that I did (link in my previous post) and check if this has been checked or not? It's being more than a week since I created it and there were no comments on this. Thank you in advance. Kosta.

harishaidary | Posts: 1812

Reply to: How to validate if a document holds required text-anchor?

1 votes
Hi Kosta, An enhancement request has indeed been created on our side. Our product management will assess and make a decision. I will keep you posted for any updates.

Kosta | Posts: 10

Reply to: How to validate if a document holds required text-anchor?

0 votes
Hello Haris, Thank you very much for the update :)

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