Sign document with Stamp signature - advanced

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Signature MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →

GroupDocs.Signature provides StampSignOptions class with additional properties to specify different options for Stamp Signature. This signature type implements stamps with different implementation, forms, lines etc. Each Stamp option contains inner and outer lines. Inner lines represent vertical lines inside the stamp, when outer lines represent circles (or rectangles based on stamp type) around stamp with own text, border settings, background etc

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

  • Create new instance of Signature class and pass source document path as a constructor parameter.
  • Instantiate the StampSignOptions object according to your requirements and specify Text Signature options.
  • Call Sign method of Signature class instance and pass StampSignOptions to it.
  • Analyze SignResult result to check newly created signatures if needed.

This example shows how to add Stamp signature to document. See SignResult

using (Signature signature = new Signature(filePath))
{
    // setup options with text of signature
    StampSignOptions signOptions = new StampSignOptions()
    {
        Height = 300,
        Width = 300,
        VerticalAlignment = VerticalAlignment.Bottom,
        HorizontalAlignment = HorizontalAlignment.Right,
        Margin = new Padding() { Right = 10, Bottom = 10 },
        Background = new Background() { Color = Color.DarkOrange },
        BackgroundColorCropType = StampBackgroundCropType.OuterArea,
        ImageFilePath = @"center.jpg",
        BackgroundImageCropType = StampBackgroundCropType.InnerArea,
        AllPages = true
    };
    //add few outer round lines
    signOptions.OuterLines.Add(
        new StampLine()
        {
            Text = "* European Union *",
            TextRepeatType = StampTextRepeatType.FullTextRepeat,
            Font = new SignatureFont() { Size = 12 },
            Height = 22,
            TextBottomIntent = 6,
            TextColor = Color.WhiteSmoke,
            BackgroundColor = Color.DarkSlateBlue
        }
    );
    signOptions.OuterLines.Add(
        new StampLine()
        {
            Height = 2,
            BackgroundColor = Color.White
        }
    );
    signOptions.OuterLines.Add(
        new StampLine()
        {
            Text = "* Entrepreneur *",
            TextRepeatType = StampTextRepeatType.FullTextRepeat,
            TextColor = Color.DarkSlateBlue,
            Font = new SignatureFont() { Size = 15 },
            Height = 30,
            TextBottomIntent = 8,
            InnerBorder = new BorderLine() { Color = Color.DarkSlateBlue, DashStyle = DashStyle.Dot },
            OuterBorder = new BorderLine() { Color = Color.DarkSlateBlue },
        }
    );
    //Inner square lines
    signOptions.InnerLines.Add(
        new StampLine()
        {
            Text = "John",
            TextColor = Color.MediumVioletRed,
            Font = new SignatureFont() { Size = 20, Bold = true },
            Height = 40,
        }
    );
    signOptions.InnerLines.Add(
        new StampLine()
        {
            Text = "Smith",
            TextColor = Color.MediumVioletRed,
            Font = new SignatureFont() { Size = 20, Bold = true },
            Height = 40
        }
    );
    signOptions.InnerLines.Add(
        new StampLine()
        {
            Text = "SSN 1230242424",
            TextColor = Color.MediumVioletRed,
            Font = new SignatureFont() { Size = 12, Bold = true },
            Height = 40,
        }
    );
    // sign document
    string signedPath = @"C:\GroupDocs\Output\Pdf_Documents_Stamp.pdf";
    signature.Sign(signedPath, signOptions);

More resources

GitHub Examples

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

Free Online Apps

Along with the full-featured .NET library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.