GroupDocs.Signature for .NET 17.5.0 Release Notes

Major Features

There are about 15 improvements, new features and fixes in this regular release. The most notable are:

  • Implemented non-static methods to obtain Document information like getting count of document pages, size of each page and obtain document page image. Non-static methods allow to use custom input data handler to obtain document stream based passed guid identifier.
  • Introduced alternative Text Signature implementation as Watermark for all Document Types.
  • Introduced ability to specify measure units of Signature in millimeters for all Signature Types and Document Types.
  • Improved Signature Area positioning by ability to specify different measure units for location, size and margins properties
  • Optimized Signature processing for Words Documents
  • Introduced ability to put Text Signature into Form Fields of Words Documents
  • Introduced ability to put Text Signature into predefined fields for PDF Documents
  • Implemented verification of Text Signature for Form Fields of Words Documents
  • Implemented verification for Form Fields of Pdf Documents with Text Signature

Full List of Issues Covering all Changes in this Release

KeySummaryIssue Type
SIGNATURENET-2785Implement ability to put Text Signature into Form Fields of Words DocumentsNew Feature
SIGNATURENET-2788Implement ability to put Text Signature into Template/Form Fields of Pdf DocumentsNew Feature
SIGNATURENET-2798Implement ability to specify new Measure Units Millimeters for Pdf SignaturesNew Feature
SIGNATURENET-2804Implement ability to specify new Measure Units Millimeters for Slides SignaturesNew Feature
SIGNATURENET-2801Implement ability to specify new Measure Units Millimeters for Words SignaturesNew Feature
SIGNATURENET-2768Implement Document information features into non static method of Signature HandlerImprovement
SIGNATURENET-2810Implement Watermark feature for Text Signature of Cells DocumentsNew Feature
SIGNATURENET-2819Implement Watermark feature for Text Signature of PDF DocumentsNew Feature
SIGNATURENET-2816Implement Watermark feature for Text Signature of Slides DocumentsNew Feature
SIGNATURENET-2813Implement Watermark feature for Text Signature of Words DocumentsNew Feature
SIGNATURENET-2610Optimize Words Signature Implementation for Text and Image typesImprovement
SIGNATURENET-2822Implement ability to obtain Document Information over Signature HandlerNew Feature
SIGNATURENET-2825Implement ability to verify Text Signature located into Form Fields of PDF DocumentsNew Feature
SIGNATURENET-2824Implement ability to verify Text Signature located into Form Fields of Words DocumentsNew Feature

Public API and Backward Incompatible Changes

  • Added new enumeration value Millimeters for enumeration MeasureType to specify measure units in millimeters for location, size of margins.

    Here is an example of using this feature:

    Specify different Measure Unit Types for PDF Text Signature

    // setup Signature configuration
    SignatureConfig signConfig = new SignatureConfig
    {
        StoragePath = @"c:\Aspose\Test\Storage",
        OutputPath = @"c:\Aspose\Test\Output"
    };
    // instantiating the conversion handler
    SignatureHandler handler = new SignatureHandler(signConfig);
    // setup text signature options and try locate signature at top right corner
    PdfSignTextOptions signOptions = new PdfSignTextOptions("John Smith");
    signOptions.ForeColor = Color.Red;
    //setup text position on a page in 5 centimeters from top 
    signOptions.LocationMeasureType = MeasureType.Millimeters;
    signOptions.Top = 50;
    //setup signature area size in pixels
    signOptions.SizeMeasureType = MeasureType.Pixels;
    signOptions.Width = 200;
    signOptions.Height = 100;
    //setup signature margins and horizontal alignment
    signOptions.HorizontalAlignment = HorizontalAlignment.Right;
    signOptions.MarginMeasureType = MeasureType.Percents;
    signOptions.Margin.Right = 10;
    // sign document
    string signedPath = handler.Sign<string>("test.pdf", signOptions,
        new SaveOptions { OutputType = OutputType.String, OutputFileName = "DifferentMeasureUnitTypes" });
    Console.WriteLine("Signed file path is: " + signedPath);
    
  • Following static method of SignatureHandler are marked as Obsolete attribute and will be deprecated after next 3 Releases

    Obsolete static methods of SignatureHandler

    public static DocumentDescription GetPageDescriptions(string guid);
    public static byte[] GetDocumentPageImage(string guid, int? width, int? quality, int pageIndex);
    public static System.Drawing.Size GetPageSize(string guid, int signaturePageNumber, double signatureLocationX,
                double signatureLocationY, PositionInCellsDocument positionInCellsDocument);
    
  • Introduced non static methods to obtain Document information to SignatureHandler class. More examples are located here

    Obtaining information about document

    // setup Signature configuration
    SignatureConfig signConfig = new SignatureConfig
    {    
        StoragePath = @"c:\Aspose\Test\Storage",    
        OutputPath = @"c:\Aspose\Test\Output"
    };
    // instantiating the conversion handler
    SignatureHandler handler = new SignatureHandler(signConfig);
    // Document description
    DocumentDescription docInfo = handler.GetDocumentDescription(@"c:\Aspose\Test\Storage\test.pdf");
    Console.WriteLine("Document " + docInfo.Guid + " contains " + docInfo.PageCount + " pages");
    Console.WriteLine("Width of first page is " + docInfo.Pages.FirstOrDefault().Width);
    // Image from specified page
    byte[] bytesImage = handler.GetPageImage(@"c:\Aspose\Test\Storage\test.pdf", 1);
    MemoryStream memoryStream = new MemoryStream(bytesImage);
    using (Image image = Image.FromStream(memoryStream))
    {    
        // Make something with image   
        Console.WriteLine("Height of image is " + image.Height);    
        image.Save(@"c:\Aspose\Test\Output\ImageFromPage.png", ImageFormat.Png);
    }
    memoryStream.Dispose();
    // Page size
    Size pageSize = handler.GetDocumentPageSize(@"c:\Aspose\Test\Storage\test.pdf", 1);
    Console.WriteLine("Page size is " + pageSize.Height + " x " + pageSize.Width); 
    
  • Added new enumeration for Text Signature Implementation for each enumeration type like CellsTextSignatureImplementation, PdfTextSignatureImplementation, WordsTextSignatureImplementation and SlidesTextSignatureImplementation - Watermark.

    Signing PDF Documents with Text Signature As Watermark

    // setup Signature configuration
    SignatureConfig signConfig = new SignatureConfig
    {
        StoragePath = @"c:\Aspose\Test\Storage",
        OutputPath = @"c:\Aspose\Test\Output"
    };
    // instantiating the conversion handler
    SignatureHandler handler = new SignatureHandler(signConfig);
    // setup text signature options
    PdfSignTextOptions signOptions = new PdfSignTextOptions("John Smith");
    //type of implementation
    signOptions.SignatureImplementation = PdfTextSignatureImplementation.Watermark;
    // sign document
    string signedPath = handler.Sign<string>("test.pdf", signOptions,
        new SaveOptions { OutputType = OutputType.String, OutputFileName = "Pdf_TextSignatureWatermark" });
    Console.WriteLine("Signed file path is: " + signedPath);
    
  • Added new enumeration for Text Signature Implementation for Words Documents WordsTextSignatureImplementation **TextToFormField.
    **

    Signing Words Documents with Text Signature to form text field

     // setup Signature configuration
                SignatureConfig signConfig = new SignatureConfig
                {
                    StoragePath = @"c:\Aspose\Test\Storage",
                    OutputPath = @"c:\Aspose\Test\Output"
                };
                // instantiating the conversion handler
                SignatureHandler handler = new SignatureHandler(signConfig);
                // setup text signature options
                WordsSignTextOptions signOptions = new WordsSignTextOptions("John Smith");
                signOptions.SignatureImplementation = WordsTextSignatureImplementation.TextToFormField;
                signOptions.FormTextFieldType = WordsFormTextFieldType.RichText;
                signOptions.FormTextFieldTitle = "RT";
                // sign document
                string signedPath = handler.Sign<string>("Forms.docx", signOptions,
                    new SaveOptions { OutputType = OutputType.String, OutputFileName = "Words_FormFields" });
    

    Verification of Words Document signed with Text Signature to form text field

    // setup Signature configuration
    SignatureConfig signConfig = new SignatureConfig
    {
        StoragePath = @"c:\Aspose\Test\Storage",
        OutputPath = @"c:\Aspose\Test\Output"
    };
    // instantiating the conversion handler
    SignatureHandler handler = new SignatureHandler(signConfig);
    // setup digital verification options
    WordsVerifyTextOptions verifyOptions = new WordsVerifyTextOptions();
    // specify other options
    // text
    verifyOptions.Text = "John Smith";
    // type of text field
    verifyOptions.FormTextFieldType = WordsFormTextFieldType.AllTextTypes;
    // title of text field
    verifyOptions.FormTextFieldTitle = "RT";
    //verify document
    VerificationResult result = handler.Verify("Forms_signed.docx", verifyOptions);
    Console.WriteLine("Signed file verification result: " + result.IsValid);