GroupDocs.Signature for Java 21.2 Release Notes

Major Features

This release contains important bug fixes related to processing Digital Signatures with its generated unique identifiers for supported document types. Also this update contains the fix document preview. Below the list of most notable changes in release of GroupDocs.Signature for .NET 21.1:

  • Added ability to get history of actions performed with a document.
  • Implemented time stamp options for digital signatures in PDF documents.
  • Introduced for Pdf documents new type certificate type of electronic digital signatures.
  • Improved processing of blank and zero-size documents
  • Optimizing document preview for empty documents
  • Fixed few bugs with processing Barcode signatures
  • Implement ability to keep deleted signatures information.
  • List of processed signatures were added to history log records.
  • Introduced ability to keep signatures information in the Image documents.
  • Fixed major bugs with processing various data files types
  • Imroved verification of passed file type and proper signatures types.
  • Fixed few bugs with signature processing and loading documents.
  • Implement ability to hide digital signatures on document preview for PDF documents.
  • Involved option to adjust digital signature appearance on page.
  • Introduced ability to remove digital signatures from PDF documents.

Full List of Issues Covering all Changes in this Release

KeySummaryIssue Type
SIGNATURENET-2944Implement ability to use timestamp for digital signatures in Pdf DocumentsFeature
SIGNATURENET-2937Implement ability to add digital certificate to Pdf DocumentsFeature
SIGNATURENET-2936Implement ability to track document processing historyFeature
SIGNATURENET-2535Implement secured Document metadata informationFeature
SIGNATURENET-2951Return images with default size as preview result for empty Spreadsheets documentsImprovement
SIGNATURENET-2950Processing null-sized files with specific exceptionImprovement
SIGNATURENET-2975PdfDigitalSignature has no constructors definedBug
SIGNATURENET-2948Empty image is returned for documents without any contentBug
SIGNATURENET-2947Can’t get document info for empty documentsBug
SIGNATURENET-2946Wrong Barcode recognition for images with wide bordersBug
SIGNATURENET-3020Implement ability to keep signature information in image documentsFeature
SIGNATURENET-2978Keep in history process log the list of processed siganturesFeature
SIGNATURENET-2977Keep deleted signatures information in metadata for historyFeature
SIGNATURENET-3008Remove support of .DJVU filesImprovement
SIGNATURENET-3004Improve file format support verification for each Document type and operationsImprovement
SIGNATURENET-3047Fixed memory leak issue when working with metadata SignaturesBug
SIGNATURENET-3021Exception is thrown when barcodes are being searched in .webp imagesBug
SIGNATURENET-2981Not protected file requires passwordBug
SIGNATURENET-2980Can not open .odg fileBug
SIGNATURENET-2979Can not load pdf fileBug
SIGNATURENET-2952Image loading failedBug
SIGNATURENET-2948Empty image is returned for documents without any contentBug
SIGNATURENET-2791SignResult signatures are not populated with minor data for Image documentsBug
SIGNATURENET-3085Implement ability to hide digital signatures on PDF Document PreviewFeature
SIGNATURENET-3084Set additional Digital Signatures properties for PDF documentsFeature
SIGNATURENET-3083Implement ability to remove digital signatures from PDF documentsFeature

Public API and Backward Incompatible Changes

New public enumeration type PdfDigitalSignatureType was added.

New public enumeration type PdfDigitalSignatureType was added. This type describes possible values of PDF digital signature types.

  • At this moment enumeration contains two options Signature and Certificate. In first case a PDF document is signed digitally in second one it is digitally certified.

Enumeration of PDF digital signature types


/**
 * <p>
 * Describes enumeration of PDF digital signature type.
 * </p>
 */
public final class PdfDigitalSignatureType extends Object
{
	private PdfDigitalSignatureType(){}	
    /**
     * <p>
     * Digital signature.
     * </p>
     */
    public static final int Signature = 0;

    /**
     * <p>
     * Digital certificate. Each document could be certified only once.
     * </p>
     */
    public static final int Certificate = 1;
}

New public struct TimeStamp was added.

New public struct TimeStamp was added. This struct could be used for getting time stamp from third-party site to PDF digital signature.

  • At this moment enumeration struct contains Url, User and Password properties.

Struct for getting timestamp

/**
 * <p>
 * Represents data to get time stamp from third-party site.
 * </p>
 */
public class TimeStamp
{	
	
    /**
     * <p>
     * Url of third-party site.
     * </p>
     */    
    public final String getUrl(){}   
    public final void setUrl(String value){}    

    /**
     * <p>
     * User.
     * </p>
     */    
    public final String getUser(){  }    
    public final void setUser(String value){}    

    /**
     * <p>
     * Password.
     * </p>
     */    
    public final String getPassword(){}
    public final void setPassword(String value){}   

    /**
     * <p>
     * Instantiates new time stamp structure.
     * </p>
     * @param url Url of third-party site.
     * @param user User.
     * @param password Password.
     */   
    public TimeStamp(String url, String user, String password){}    

}

Public class PdfDigitalSignature was updated with new property.

Public class PdfDigitalSignature was updated with new property for PDF document specific signatures. Supported only for digital signatures.

  • new property Type of type PdfDigitalSignatureType was added to specify PDF document specific type of digital signatures.
  • new property TimeStamp of type TimeStamp was added to add possibility for getting time stamp from third-party site to PDF digital signatures.
  • four constructors were added to make process of instantiation more versatile.

New properties of PdfDigitalSignature

/**
 * <p>
 * Contains Pdf Digital signature properties.
 * </p>
 */
public class PdfDigitalSignature extends DigitalSignature
{
    /**
     * <p>
     * Type of Pdf digital signature.
     * </p>
     */
    public final int getType(){}
    public final void setType(int value){}  

    /**
     * <p>
     * Time stamp for Pdf digital signature.
     * Default value is null.
     * </p>
     */    
    public final TimeStamp getTimeStamp(){}
    public final void setTimeStamp(TimeStamp value){}  
}

Following example demonstrates how to certify a PDf document with digital signature and added timestamp.

Certifying a PDf document with digital signature and adding timestamp

//Certify pdf document with digital signature
 final Signature signature = new Signature(filePath);
        try 
        {
            PdfDigitalSignature pdfDigitalSignature = new PdfDigitalSignature();
            pdfDigitalSignature.setContactInfo("Contact");
            pdfDigitalSignature.setLocation("Location");
            pdfDigitalSignature.setReason("Reason");
            pdfDigitalSignature.setTimeStamp(new TimeStamp("https://freetsa.org/tsr", "", ""));

            //Create digital signing options
            DigitalSignOptions options = new DigitalSignOptions(certificatePath);
            options.setPassword("1234567890");
            options.setSignature(pdfDigitalSignature);
            options.setVerticalAlignment(VerticalAlignment.Bottom);
            options.setHorizontalAlignment(HorizontalAlignment.Right);

            SignResult signResult = signature.sign(outputFilePath, options);
            System.out.print("\nSource document signed successfully with "+signResult.getSucceeded().size()+" signature(s).\nFile saved at "+outputFilePath);

            System.out.print("\nList of newly created signatures:");
            int number = 1;
            for (BaseSignature temp : signResult.getSucceeded())
            {
                System.out.print("Signature #"+number++ +": Type: "+temp.getSignatureType()+" Id:"+temp.getSignatureId()+", Location: "+temp.getLeft()+"x"+temp.getTop()+". Size: "+temp.getWidth()+"x"+temp.getHeight());
            }
        }catch(Exception e){
            throw new GroupDocsSignatureException(e.getMessage());
        }
}

New public enumeration type ProcessType was added.

New public enumeration type ProcessType was added. This type describes document process type of supported operations.

Enumeration of processing types

/**
 * <p>
 * Defines supported process with documents like Info, Preview, Sign, Verify, Search, Update, Delete
 * </p>
 */
public final class ProcessType extends Object
{
    /**
     * <p>Indicates an error, unknown process type.</p>
     */
    public static final int Unknown = 0;
    /**
     * <p>Obtain document information process.</p>
     */
    public static final int Info = 1;
    /**
     * <p>Indicates method GeneratePreview().</p>
     */
    public static final int Preview = 2;
    /**
     * <p>Signing process type.</p>
     */
    public static final int Sign = 3;
    /**
     * <p>Document verification process.</p>
     */
    public static final int Verify = 4;
    /**
     * <p>Signatures searching process.</p>
     */
    public static final int Search = 5;
    /**
     * <p>Update document signatures process.</p>
     */
    public static final int Update = 6;
    /**
     * <p>Delete document signatures process</p>
     */
    public static final int Delete = 7;
}

New public class ProcessLog was added.

New public class type ProcessLog was added to keep document process information like date/time, type of the process (ProcessType), message, quantity of succeeded and quantity of failed signatures.

ProcessLog class properties

/**
 * <p>
 * Represents document process details.
 * </p>
 */
public final class ProcessLog
{
	/**
	 * <p>
	 * Get the process date and time.
	 * </p>
	 */    
    public final java.util.Date getDate() { return Date; }

    /**
     * <p>
     * Get the process type.
     * </p>
     */    
    public final /*ProcessType*/int getType(){ return auto_Type; }
        
    /**
     * <p>
     * Get the process description.
     * </p>
     */    
    public final String getMessage(){ return auto_Message; }
   
    /**
     * <p>
     * Quantity of successfully processed signatures.
     * </p>
     */    
    public final int getSucceeded(){ return auto_Succeeded; }
   
    /**
     * <p>
     * Quantity of signatures that failed during processing.
     * </p>
     */    
    public final int getFailed(){}
   
	/**
	 * <p>
	 * The list of successfully processed signatures.
	 * </p>
	 */    
    public final java.util.List<BaseSignature> getSignatures() {}
   
}

Public interface IDocumentInfo was extended with new property

Public interface IDocumentInfo was extended with new properties.

  • ProcessLogs property as IList of ProcessLog objects to keep the list of document process history log records.

New property ProcessLogs of IDocumentInfo interface

/**
 * <p>
 *  Defines document description properties.
 * </p>
 */
public interface IDocumentInfo
{
	/**
	 * <p>
	 * Collection of document history process logs.
	 * </p>
	 */    
	public List<ProcessLog> getProcessLogs();
}

Public class DocumentInfo was extended with new property.

Public interface DocumentInfo was extended with new property ProcessLogs to keep the list of document process history log records.

New property ProcessLogs of DocumentInfo class

public class DocumentInfo implements IDocumentInfo
{
	...
	
	/**
	 * <p>
	 * Collection of document history processes like Sign, Update, Delete.
	 * </p>
	 */		
	public final java.util.List<ProcessLog> getProcessLogs(){}
}

New property Deleted of BaseSignature was added.

New boolean property Deleted was added to class BaseSignature. This property signals if Signature object was deleted from the Document.

public abstract class BaseSignature
{
	...
	
	/**
	 * <p>
	 * Get flag to indicate if this signature was deleted from the document.
	 * This property is being used only for document history log records to keep the list of deleted signatures.
	 * </p>
	 */		
	public final boolean getDeleted(){}
}

Obsolete member Stamp was removed from enumeration TextSignatureImplementation.

Obsolete member Stamp of enumeration TextSignatureImplementation was removed and no longer supported. Please use enumeration value Native instead.

Obsolete member Border was removed from ImageAppearance

Obsolete member Stamp of enumeration TextSignatureImplementation was removed and no longer supported. Please use enumeration value Native instead.

New constructor with string signature unique identifier for class DigitalSignature is the list of processed signatures

New constructor class DigitalSignature allows to create instance with predefined signature identifier.

New constructor DigitalSignature

public class DigitalSignature extends BaseSignature
{
	/**
     * <p>
     * Initialize Digital signature with known SignatureId.
     * </p>
     */    
    public DigitalSignature(String signatureId){}
}

Following example shows how to delete Digital signature by known signature identifier.

// initialize Signature instance
final Signature signature = new Signature("signedSample.pdf");
{
    DigitalSignature dsSignature = new DigitalSignature("a01e1940-997a-444b-89af-9309a2d559a5");
    
    // delete required signatures
	boolean result = signature.delete(new ByteArrayOutputStream(),dsSignature);
	if (result)
	{
		System.out.print("All signatures were successfully deleted!");
	}
	else
	{
		System.out.print("Not digital signatures : "+dsSignature.getSignatureId());
	}
}

New boolean property ShowProperties of class PdfDigitalSignature was added

New boolean property ShowProperties was added to class PdfDigitalSignature. This property allow to adjust appearance of Digital signture on Pdf document page.

public class PdfDigitalSignature extends DigitalSignature
{

	....
	
	/**
     * <p>
     * Force to show/hide signature properties. In case ShowProperties is true signature
     * field has predefined format of appearance 
     *     Digitally signed by {{@code ContactInfo}({@link #getContactInfo}/{@link #setContactInfo(String)})} Date: {Date} Reason: {{@code Reason}({@link #getReason}/{@link #setReason(String)})}
     *     Location: {{@code Location}({@link #getLocation}/{@link #setLocation(String)})}
     * ShowProperties is true by default.
     * </p>
     */    
    public final boolean getShowProperties(){}    
    public final void setShowProperties(boolean value){}
}