sudhangi

Upload multiple documents to a package

0 votes
Hi , I am able to successfully upload a single document while creating a package . What all changes do I need to make to the java code to allow upload of multiple documents? I need to simultaneously upload multiple pdf’s after inserting signatures in each document and then create a pacakge out of all these documents. Thanks, Sudhangi

Reply to: Upload multiple documents to a package

0 votes
Hi Sudhangi, Creating a package with multiple documents is a simple process. All you need to do is create a document object for each pdf and adding a .withDocument() method for each document object when building your package object. Below is an example code on how to create a package with two documents:
 EslClient client = new EslClient(API_KEY, API_URL);
		
		PackageBuilder packageToBuild = PackageBuilder.newPackageNamed("Multiple Documents Example");
		
		SignerBuilder signer1 = SignerBuilder.newSignerWithEmail("[email protected]")
				.withFirstName("Haris")
				.withLastName("Haidary")
				.withCustomId("Signer");
		
		DocumentBuilder document1 = DocumentBuilder.newDocumentWithName("Cleaning Contract")
				.fromFile("C:/Users/hhaidary/Desktop/pdf/cleaning_contract.pdf")
				.withSignature(SignatureBuilder.signatureFor("[email protected]")
						.atPosition(100, 100)
						.onPage(0));
		
		DocumentBuilder document2 = DocumentBuilder.newDocumentWithName("Sample Contract")
				.fromFile("C:/Users/hhaidary/Desktop/pdf/doc1.pdf")
				.withSignature(SignatureBuilder.signatureFor("[email protected]")
						.atPosition(100, 100)
						.onPage(0));
		
		DocumentPackage packageToSend = packageToBuild.withSigner(signer1).withDocument(document1).withDocument(document2).build();
		
		PackageId packageId = client.createAndSendPackage(packageToSend);
Haris Haidary OneSpan Technical Consultant

Reply to: Upload multiple documents to a package

0 votes
Thank you Haris. That worked.

Reply to: Upload multiple documents to a package

0 votes
You're welcome. Let me know if you have any other questions :)
Haris Haidary OneSpan Technical Consultant

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