Digital signature APIs for .NET and Java to e-Sign documents and images

e-Sign PDF, DOCX, XLSX, PPTX, RTF, TXT, PNG, JPG, TIFF, BMP, SVG, PSD, EMF, and many more file types. Perform virtual signing of files by adding text, image, barcode, and stamp signatures.

Try our APIs for FreeGet Temporary License

Many ways to sign your business files

Digital signatures are a type of electronic signature that can be used to sign business documents and images. They are typically used for contracts, legal documents, and other sensitive information. Digital signatures are utilized primarily with digital files and are considered to be more secure and standardized than traditional signatures (also known as wet signatures). The process of electronically incorporating digital signatures into your personal or official files is referred to as e-signing.

Furthermore, an e-signature could also be thought of as a mathematical scheme for demonstrating not only the authenticity but also the integrity of digitally processed files. The native APIs of GroupDocs.Signature for .NET and Java are a must-have for software developers who want to build fully flexible signing apps for popular file formats such as PDF, Microsoft Office, and OpenOffice documents, and images. The APIs let you add, search, update, or delete multiple types of signatures to your documents and images.

Getting Started

Before you start e-signing your documents, please make sure to review the .NET and Java installation guides of GroupDocs.Signature APIs as a prerequisite.

Document, image, and text comparison use cases

We will now check some of the popular document e-signing use cases across .NET and Java platforms.

How to sign PDF, Word, Excel, and PowerPoint documents with text, image, stamp, barcode, and digital signatures

Adding an electronic signature, or e-signature to a document is a great way to make sure that the document is valid and can be used for legal, or other specific purposes. e-Signs have mostly replaced the earlier practice of signing contracts or legal documents with a physical pen and paper. An e-signature can be as simple as typing your name into a document or as complex as using a digital signature. GroupDocs.Signature APIs support adding a host of different signature types allowing developers to build MS Office documents, images, and PDF signer apps in .NET and Java. This section will show you how to add these signatures to your data files.

How to sign PDF, Word, Excel, and PowerPoint documents with text, image, stamp, barcode, and digital signatures

Sign PDF and other documents with text signatures in .NET

Using the C# code added below, you can insert text-based electronic signatures to your documents:
using (Signature signature = new Signature("sample.pdf"))
{
    TextSignOptions options = new TextSignOptions("John Smith")
    {
        // set signature position
        Left = 100,
        Top = 100,
        // set signature rectangle
        Width = 100,
        Height = 30,
        // set Text color and Font
        ForeColor = Color.Red,
        Font = new SignatureFont { Size = 12, FamilyName = "Comic Sans MS" }
    };
    // sign document to file
    signature.Sign("sample_signed.pdf", options);
} 

e-Sign your Java files with text signatures

For adding text signatures to your documents in Java, please use the following code snippet:
Signature signature = new Signature("sample.pdf");
TextSignOptions options = new TextSignOptions("John Smith");
// set signature position
options.setLeft(100);
options.setTop(100);

// set signature rectangle
options.setWidth(100);
options.setHeight(30);

// set text color and Font
options.setForeColor(Color.RED);
SignatureFont signatureFont = new SignatureFont();
signatureFont.setSize(12);
signatureFont.setFamilyName("Comic Sans MS");
options.setFont(signatureFont);

// sign document to file
signature.sign("sample_signed.pdf", options); 

Sign your .NET documents electronically with image signatures

You can update your official documents by adding image signatures using the following C# coding:
using (Signature signature = new Signature("sample.pdf"))
{
    ImageSignOptions options = new ImageSignOptions("signature.jpg")
    {
        // set signature position
        Left = 100,
        Top = 100,
        AllPages = true
    };
    signature.Sign("SampleSigned.pdf", options);
}  

Insert image signatures to files in your Java apps

Please use the below-given Java coding to insert image signatures to your multi-format documents:
Signature signature = new Signature("sample.docx");
ImageSignOptions options = new ImageSignOptions("signature.jpg");
// set signature position
options.setLeft(100);
options.setTop(100);
options.setPageNumber(1);
// sign document to file
signature.sign("SampleSigned.docx", options);  

Electronically sign your files with digital signatures in C# .NET apps

Digital signatures could help you with the authenticity of electronically transferred documents. Here’s how you can digitally sign your files in C#:
    using (Signature signature = new Signature("sample.pdf"))
{
    // initialize digital option with certificate file path
    DigitalSignOptions options = new DigitalSignOptions("certificate.pfx")
    {
        // optional image setup (file path)
        ImageFilePath = "sample.jpg",
        // set signature position
        Left = 100,
        Top = 100,
        // set
        Password = "1234567890"
    };
    signature.Sign("sampleSigned.pdf", options);
} 

Integrate e-signing functionality into your Java files with digital signatures

Enhance the authenticity of your business files in Java by inserting digital signatures using the following code snippet:
        Signature signature = new Signature("sample.pdf");
DigitalSignOptions options = new DigitalSignOptions("certificate.pfx");
 // optional image setup (file path)
options.setImageFilePath("sample.jpg");
options.setLeft(100);
options.setTop(100);
options.setPassword("1234567890");
// sign document to file
signature.sign("sampleSigned.pdf", options); 
You can also add stamp, barcode, QR code, and metadata e-signatures to your documents using GroupDocs.Signature APIs. If you are a .NET developer, please check out more types of signatures and how to add them to your .NET apps. Similarly, if you are a Java developer, you have different virtual signing options for the Java platform too.

How to modify e-signatures from within the .NET and Java data files

While working with PDF, Microsoft Office, OpenOffice, or image files, you might need to update the e-signatures that are added to them. It could be challenging if you are up against large volumes of file data but important at the same time to keep document integrity intact. One of the best methods of handling this is automating the modification process by developing a software module that systematically updates the electronic signatures injected into your files. This is where GroupDocs.Signature APIs are extremely useful. These high-performance APIs pack a powerful feature set to update your e-signs easily. In this section, we will deal with updating the text signature and image signatures.

How to modify e-signatures from within the .NET and Java data files

Update Text and image signatures in .NET e-signing apps

Manipulate the contents of text signatures by using the below-shared C# code:
// Passing the document to class constructor in which the signature will be updated 
using (Signature signature = new Signature("sampleSigned.pdf"))
{
    TextSearchOptions options = new TextSearchOptions();
    // search for text signatures in document
    List signatures = signature.Search(options);
    if(signatures.Count > 0)
    {
        TextSignature textSignature = signatures[0];
        // change Text property
        textSignature.Text = "John Walkman";
        // change position
        textSignature.Left = textSignature.Left + 10;
        textSignature.Top = textSignature.Top + 10;
        // change size. Please note not all documents support changing signature size
        textSignature.Width = 200;
        textSignature.Height = 100;
        bool result = signature.Update(textSignature);
        if(result)
        {
            Console.WriteLine($"Signature with Text '{textSignature.Text}' was updated in the document ['{fileName}'].");
        }
        else
        {
            Console.WriteLine($"Signature was not updated in the document! Signature with Text '{textSignature.Text}' was not found!");
        }
    }
}    
For changing the image signature contents inside a PDF document, please use this .NET code:
// Pass the document to class constructor in which the signature will be updated
using (Signature signature = new Signature("sampleSigned.pdf"))
{
    ImageSearchOptions options = new ImageSearchOptions();
    // search for image signatures in document
    List signatures = signature.Search(options);
    if(signatures.Count > 0)
    {
        ImageSignature imageSignature = signatures[0];
        // change Image properties
        signatureToUpdate.Top = 200;
        signatureToUpdate.Left = 200;
        signatureToUpdate.Width = 300;
        signatureToUpdate.Height = 150;

        bool result = signature.Update(imageSignature);
        if(result)
        {
            Console.WriteLine($"Signature with Top '{imageSignature.Top}' was updated in the document ['{fileName}'].");
        }
        else
        {
            Console.WriteLine($"Signature was not updated in the document! Signature with Top '{imageSignature.Top}' was not found!");
        }
    }
} 

Modify the contents of image and text signatures within your Java apps

Let’s check the code to change or manipulate the contents of the text signature in Java:
Signature signature = new Signature("sampleSigned.pdf");
try {
    TextSearchOptions options = new TextSearchOptions();
    // search for text signatures in document
    List signatures = signature.search(TextSignature.class, options);
    if (signatures.size() > 0) {
        TextSignature textSignature = signatures.get(0);
        // change Text property
        textSignature.setText("John Walkman");
        // change position
        textSignature.setLeft(textSignature.getLeft() + 50);
        textSignature.setTop(textSignature.getTop() + 50);
        // change size. Please note not all documents support changing signature size
        textSignature.setWidth(200);
        textSignature.setHeight(100);
 
        boolean result = signature.update("sampleSigned.pdf",textSignature);
        if (result) {
            System.out.print("Signature with Text '" + textSignature.getText() + "' was updated in the document ['sampleSigned.pdf'].");
        } else {
            System.out.print("Signature was not updated in the document! Signature with Text '" + textSignature.getText() + "' was not found!");
        }
    }
} catch (Exception e) {
    throw new GroupDocsSignatureException(e.getMessage());
}
And here’s the code to programmatically update image signatures in Java documents:
using (Signature signature = new Signature("sampleSigned.pdf"))
{
    ImageSearchOptions options = new ImageSearchOptions();
    // search for image signatures in document
    List signatures = signature.Search(options);
    if(signatures.Count > 0)
    {
        ImageSignature imageSignature = signatures[0];
        // change Image properties
        signatureToUpdate.Top = 200;
        signatureToUpdate.Left = 200;
        signatureToUpdate.Width = 300;
        signatureToUpdate.Height = 150;

        bool result = signature.Update(imageSignature);
        if(result)
        {
            Console.WriteLine($"Signature with Top '{imageSignature.Top}' was updated in the document ['{fileName}'].");
        }
        else
        {
            Console.WriteLine($"Signature was not updated in  the document! Signature with Top '{imageSignature.Top}' was not found!");
        }
    }
} 

How to search for the eSigns added to PDF, Microsoft Office documents, and images

Searching for the eSigns added to a document lets you verify the authenticity of the document. If you are working in a distributed team, and regularly deal with different kinds of files, the best way would be to use a tool that not only equips you with adding or making signatures but also manipulating and searching them when needed. Based on the search results, any files with the e-signs missing could then be re-evaluated and processed accordingly. GroupDocs.Signature native APIs for .NET and Java include signature searching features for PDF and other documents, spreadsheets, presentations, and many more data formats. In this section, we will be checking how you can search for a few different types of e signatures in .NET and Java.

How to search for the eSigns added to PDF, Microsoft Office documents, and images

Search for image signatures added to your business documents in .NET

To perform a search of the image type signatures available in your .NET files, please check the example code below:
    using (Signature signature = new Signature("sample.pdf"))
{
    // search document
    List signatures = signature.Search(SignatureType.Image);
    Console.WriteLine($"\nSource document ['{fileName}'] contains following image signature(s).");
    // output signatures
    foreach (ImageSignature imageSignature in signatures)
    {
        Console.WriteLine($"Image signature found at page {imageSignature.PageNumber} with size {imageSignature.Size}. Created {imageSignature.CreatedOn}, modified {imageSignature.ModifiedOn}");
    }
}    
You can also search for many other types of eSigns injected within your files in .NET similarly.

Look for text e-signatures in Java documents seamlessly

Searching for text-based electronic signatures is possible in Java too. Please refer to the following coding example for help:
    Signature signature = new Signature(sample.pdf);
 // setup search options
TextSearchOptions options = new TextSearchOptions();
// specify as true to search all pages of a document
options.setAllPages(true);
// search only page with specified number
options.setPageNumber(1);
// specify text math type    
options.setMatchType(TextMatchType.Contains);
// specify text to search
options.setText("John Smith");
 
// search for text signatures in document
List signatures = signature.search(TextSignature.class,options);
// output signatures
for (TextSignature textSignature : signatures)
 {
 
     if (textSignature != null)
     {
         System.out.print("Found Text signature at page "+sign.getPageNumber()+" with type ["+sign.getSignatureImplementation()+"] and text '"+sign.getText()+"'.");
         System.out.print("Location at "+sign.getLeft()+"-"+sign.getTop()+". Size is "+sign.getWidth()+"x"+sign.getHeight()+".");
     }
 } 
Apart from text e-signs, you can also try finding many other types of e signs in Java.

A guide to removing virtual signs from your official and legal documents

When you delete your electronic signature from a document, it's important to understand why you're doing it and the best way to do it. Deleting electronic signatures from documents could be required for a variety of reasons. For instance, the document may no longer be needed or the signer may no longer have a valid reason to keep their signature on the document. Alternatively, the document may have been changed or updated deeming the signature invalid. Regardless of the reasons, GroupDocs.Signature for .NET and Java APIs have the solutions for you. This section will cover how you can remove e-signs from documents.

A guide to removing virtual signs from your official and legal documents

Remove text e-signs from documents in C# .NET apps

Once you have searched for the text sign in any supported data file, you can delete it as shown in this example with different advanced options:
    // initialize Signature instance
using (Signature signature = new Signature("signed.pdf"))
{
    TextSearchOptions options = new TextSearchOptions();
    List signatures = signature.Search(options);
    List signaturesToDelete = new List();
    // collect signatures to delete
    foreach (TextSignature temp in signatures)
    {
        if (temp.Text.Contains("John"))
        {
            signaturesToDelete.Add(temp);
        }
    }
    // delete signatures
    DeleteResult deleteResult = signature.Delete(signaturesToDelete);
    if (deleteResult.Succeeded.Count == signaturesToDelete.Count)
    {
        Console.WriteLine("All signatures were successfully deleted!");
    }
    else
    {
        Console.WriteLine($"Successfully deleted signatures : {deleteResult.Succeeded.Count}");
        Console.WriteLine($"Not deleted signatures : {deleteResult.Failed.Count}");
    }
    Console.WriteLine("List of deleted signatures:");
    foreach (BaseSignature temp in deleteResult.Succeeded)
    {
        Console.WriteLine($"Signature# Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");
    }
}          

Delete image e-signature from documents in Java

Here’s how you can search and remove image-based signatures from your digitally signed files with a few advanced options:
    // initialize Signature instance
Signature signature = new Signature("signed.docx");
ImageSearchOptions options = new ImageSearchOptions();
 
List signatures = signature.search(ImageSignature.class, options);
List signaturesToDelete = new ArrayList();
// collect signatures to delete
for (ImageSignature temp : signatures)
{
    if (temp.getSize() > 10000)
    {
        signaturesToDelete.add(temp);
    }
}
// delete signatures
DeleteResult deleteResult = signature.delete("signed.docx",signaturesToDelete);
if (deleteResult.getSucceeded().size() == signaturesToDelete.size())
{
    System.out.print("All signatures were successfully deleted!");
}
else
{
    System.out.print("Successfully deleted signatures : "+deleteResult.getSucceeded().size());
    System.out.print("Not deleted signatures : "+deleteResult.getFailed().size());
}
System.out.print("List of deleted signatures:");
for(BaseSignature temp : deleteResult.getSucceeded())
{
    System.out.print("Signature# Id:"+temp.getSignatureId()+", Location: "+temp.getLeft()+"x"+temp.getTop()+". Size: "+temp.getWidth()+"x"+temp.getHeight());
} 
GroupDocs.Signature APIs provide many more advanced document e-signature manipulation options for .NET and for Java too. If you are looking for free online DOCX, PPTX, XLSX, ODS, OTS, JPEG, or PDF signer on the go, please try the GroupDocs.Signature digital signing apps.

Independently automate your document and image processing tasks

Why choose GroupDocs?

Unmatched file formats support

  • All popular file formats supported including documents, images, audio, videos, and ebooks.
  • PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, PUB, PNG, PSD, ODT, MSG, EML, MP3, MP4, and many more.

Extensively programmable libraries

  • Use GroupDocs APIs to build fully customizable .NET and Java apps.
  • Manipulate your business documents, spreadsheets, presentations, and images any way you like.

Hundreds of supported features

  • Convert Word or Excel to PDF, annotate PDFs, edit DOC, DOCX, or watermark files.
  • Work with esignatures, tables, mail-merge, attachments, shapes, and much more.

Tailored to your needs

  • Free trials and different paid licensing options to choose from.
  • Well-suited to individual users, startups, as well as small and large enterprises.

APIs for Developers

  • Programmatically process your digital documents and images in .NET and Java platforms.
  • Document APIs designed specifically for .NET and Java application developers.

Trusted by users globally

  • Preferred by developers and businesses alike, our libraries are used globally.
  • Generate optimised documents easily in standalone and distributed environments.

Do more with your documents and images

  • Create, render, edit, convert, compare, digitally sign, watermark, and export your files.
  • Experience endless possibilities by creating multi-functional, high-performance apps.

Simple integration and convenient application

  • Enjoy greater flexibility by integrating with your existing software applications.
  • Get up and running using a few lines of code with our super-fast and reliable APIs.

Multiple support channels

  • Need help? Look no further than one of our developer-led support options.
  • Explore the APIs structure, and documentation, or dive into the knowledge base.

Ready to get started?

Download Free Trial