Migration Notes

Why To Migrate?

Here are the key reasons to use the new updated API provided by GroupDocs.Signature for .NET since version 19.8:

  • Signature class introduced as aΒ single entry pointΒ to sing the document with various signature types with further verification and search with any supported file format.
  • DocumentΒ signature options (SignOptions), verify options (VerifyOptions) and search options (SearchOptions) were unifiedΒ for all document types. Instead of using document related options now options are related to signature type only.
  • The overall document related classes were unified to common.
  • Product architecture was redesigned from scratch in order to simplify passing options and classesΒ to manipulate signature.
  • Document information and previewΒ generation procedures were simplified.

How To Migrate?

Here is a brief comparison of how to sign document with text signature using old and new API.

Old coding style

// setup Signature configuration
SignatureConfig signConfig = new SignatureConfig
{
    StoragePath = @"c:\Aspose\Test\Storage",
    OutputPath = @"c:\Aspose\Test\Output"
};
// instantiating the signature handler
SignatureHandler handler = new SignatureHandler(signConfig);
// setup text signature options
PdfSignTextOptions signOptions = new PdfSignTextOptions("John Smith")
{
    // locate signature
    Left = 100, Top = 100, Width = 100, Height = 30,
    // set Text color and Font
    ForeColor = Color.Red,
    Font = new SignatureFont { FontSize = 12, FontFamily = "Comic Sans MS" }
};
SaveOptions saveOptions = new SaveOptions { OutputType = OutputType.String, OutputFileName = "signed.pdf" };
// sign document
string signedPath = handler.Sign<string>("test.pdf", signOptions,saveOptions);
Console.WriteLine("Signed file path is: " + signedPath);

New coding style

using (Signature signature = new Signature("sample.pdf"))
{
    TextSignOptions options = new TextSignOptions("John Smith")
    {
        // locate signature
        Left = 100, Top = 100, 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("signed.pdf", options);
}

For more code examples and specific use cases please refer to ourΒ Developer GuideΒ documentation orΒ GitHubΒ samples and showcases.