Sign document with Image signature - advanced

GroupDocs.Signature provides ImageSignOptions class to specify different options for Image signature as follow

Here are the steps to add Image signature into document with GroupDocs.Signature:

  • Create new instance of Signature class and pass source document path as a constructor parameter.

  • Instantiate the ImageSignOptions object according to your requirements and specify image signature options.

  • Call Sign method of Signature class instance and pass ImageSignOptions to it.

  • Analyze SignResult result to check newly created signatures if needed.

This example shows how to specify different Image signature options. See SignResult

using (Signature signature = new Signature("sample.xlsx"))
    ImageSignOptions options = new ImageSignOptions("sample.jpg")
        // set signature position 
        Left = 100,
        Top = 100,
        // set signature rectangle
        Width = 100,
        Height = 30,
        // set signature alignment
        // when VerticalAlignment is set the Top coordinate will be ignored. 
        // Use Margin properties Top, Bottom to provide vertical offset
        VerticalAlignment = Domain.VerticalAlignment.Top,
        // when HorizontalAlignment is set the Left coordinate will be ignored. 
        // Use Margin properties Left, Right to provide horizontal offset
        HorizontalAlignment = Domain.HorizontalAlignment.Right,
        Margin = new Padding() { Top = 20, Right = 20 },
        // set rotation
        RotationAngle = 45,
        // setup image additional appearance as Brightness and Border
        Appearance = new ImageAppearance()
            Brightness = 0.9f,
            Border = new Border()
                Color = Color.DarkGreen,
                DashStyle = DashStyle.DashLongDashDot,
                Transparency = 0.5,
                Visible = true,
                Weight = 2
    // sign document to file
    SignResult signResult = signature.Sign("sgnedSample.xlsx", options);
    Console.WriteLine("List of newly created signatures:");
    int number = 1;
    foreach (BaseSignature temp in signResult.Succeeded)
        Console.WriteLine($"Signature #{number++}: Type: {temp.SignatureType} Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App 

Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.