LEADTOOLS V22 Update Deep Dive – eSignatures

We hope you’ve been busy exploring our entire new update to LEADTOOLS Version 22! Let’s take a deep dive into the latest new feature added to the LEADTOOLS Document SDK: eSignatures. Developers using LEADTOOLS are now easily able to add electronic signatures as well as digitally sign documents without rasterizing or changing the underlying PDF.

Types of Electronic Signatures

In the paperless era we’re living in, the ability to sign documents and PDFs electronically is becoming more and more standard. Similar to a handwritten signature on a paper document, electronic signatures can actually be much more secure. Simple Electronic Signatures (SES) are the broadest level of signature on an electronic document. They do not need any type of identification. Advanced Electronic Signatures (AES) take security a step further by requiring a level of identity verification. They are typically based on digital signature certificates that uniquely identify the signer of the electronic document.

Not sure which signature is best to integrate into your application? Good news – LEADTOOLS has you covered for both types of electronic signatures!

LEADTOOLS eSignatures

Our eSignature technology is ready-to-use in the LEADTOOLS Document Viewer. Using LEADTOOLS you can choose to either add simple electronic signatures to documents or you can combine with LEADTOOLS certificate-based digital signing for advanced electronic signatures. This digital signing certificate provides verification and ensures that the contents of the document have not been altered or further manipulated in any way.

Try it out! Run the eSignature Demo in Design or Sample Mode

You can run the Document Viewer demo in Design Mode to add your own signatories and eSignature fields or run the demo with sample signatories and eSignature fields already incorporated.

  • Create eSignatures
  • Add signature fields to your document for any number of signatories
    • Full Name
    • Initials
  • Incorporate certificate-based Digital Signing

Create an eSignature – Example in C# .NET

The code below will show you how to easily load a document and sign it, using a PNG signature image.


static void Main(string[] args) 
{ 
	InitLEAD(); 

	var pdfToSign = @"C:\LEADTOOLS22\Resources\Images\RentalLeaseAgreement.pdf"; 

	using var document = DocumentFactory.LoadFromFile(pdfToSign, new LoadDocumentOptions()); 

	// Define signarure and resources 
	var resources = document.FormFields.GetResources(); 
	var signature = resources.CreateSignature(); 
	// SignerName and SignerInitial are optional fields 
	signature.SignerName = "John D."; 
	signature.SignerInitials = "JD"; 

	// Set the image for the signature 
	signature.SignatureImage = DocumentFactory.RasterCodecsTemplate.Load("Dotnet-Sign-Documents-With-LEADDocument.png"); 

	// If you would like to add an image for initial fields 
	//signature.InitialsImage = DocumentFactory.RasterCodecsTemplate.Load(@"PATH_TO_INITIAL_IMAGE"); 

	resources.Signatures.Add(signature); 

	// Update the document resources 
	document.FormFields.SetResources(resources); 

	// Now we have the resource ready, we can create the signatures fields 
	var signatureField = new DocumentSignatureFormField() 
	{ 
		Bounds = new LeadRectD(3200, 600, 1800, 800), // Place the signature on the signature line in the document 
		SignerID = signature.SignerID, // Link the signature field to the Document Signature Resource 
		Signed = true 
	}; 

	// Create a container and add the signature field to it. Use page 7 for this document 
	var container = new DocumentFormFieldsContainer(); 
	container.PageNumber = 7; 
	container.Children.Add(signatureField); 

	if (document.IsReadOnly) document.IsReadOnly = false; 

	// Set the form fields containers in LEAD Document 
	document.FormFields.SetFormFields(new DocumentFormFieldsContainer[] { container }); 

	var converter = new DocumentConverter(); 
	var job = converter.Jobs.CreateJob(new DocumentConverterJobData 
	{ 
		Document = document, 
		DocumentFormat = Leadtools.Document.Writer.DocumentFormat.Pdf, 
		OutputDocumentFileName = Path.Combine(Path.GetDirectoryName(pdfToSign), Path.GetFileNameWithoutExtension(pdfToSign) + "_signed.pdf") 
	}); 
	converter.Jobs.RunJob(job); 

	if (job.Errors.Count > 0) 
		foreach (var error in job.Errors) 
			Console.WriteLine($"Error: {error.Error.Message}"); 
	else 
		Console.WriteLine($"Signed and saved to: {job.OutputDocumentFiles.First()}"); 
}

For more information please refer to the full Sign Documents with LEADDocument tutorial.

Add a Digital Signature Certificate- Example in C# .NET

Add a layer of security to the document by creating a digital certificate for the PDF. This certificate is used to verify that the document has not been altered. Only a few lines of code are needed to sign a PDF.

static void SignPDFDocument() 
{ 
	string inputFile = @"SOURCE PDF FILE PATH"; 
	string outputFile = @"FILE PATH TO OUTPUT SIGNED PDF TO"; 
	string signatureFile = @"FILE PATH TO PFX SIGNATURE FILE"; 

	try 
	{ 
		PDFFile inputDoc = new PDFFile(inputPdf); 
		inputDoc.SignDocument(outputPdf, signatureFile, "password"); 
	} 
	catch (Exception ex) 
	{ 
		Console.WriteLine(ex.Message); 
		return; 
	} 
		Console.WriteLine("Signed PDF successfully"); 
} 

For more information please refer to the full PDF digital signature tutorial.

Start Coding for FREE!

See just how easy eSignatures can be added to your specific application with a free 60-day evaluation of the LEADTOOLS toolkit. You will get the source code to the Document Viewer demo referenced above, along with many more demos showcasing LEADTOOLS functionality. PLUS we provide free technical support throughout your evaluation.

Schedule a demo with our support team, consult with a sales specialist, or use our product wizard and pricing tools to configure an estimate for your specific application needs.

This entry was posted in General and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *