Error on class SignatureHandler (The type or namespace SignatureHandler could not be found) : GroupDocs

119 Views Asked by At

I am working on a project in which we are using groupdocs, I recently updated the version to 20.1 from 19.8, and now I am getting the following error

CS0246 C# The type or namespace name could not be found (are you missing a using directive or an assembly reference?)

the error is coming on the following line of code

private static SignatureHandler SignatureHandler;

I didn't changed any code just changed the version of groupdocs signature

when i studied the release note I found out the legacy api which contains handler has been removed in the same version (20.1) and hence, the following namespace is also throwing error

GroupDocs.Signature.Legacy.Handler;

here is the release of groupdocs signature 20.1

release note

what can be the fixes for me?

1

There are 1 best solutions below

0
On

In API v20.1, we've removed the legacy API support from the product.

what can be the fixes for me?

Below is the new code 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);
}

SignatureHandler is no longer supported. Please have a look at these migration notes for more insights.