A stamp signature is a special type of electronic signature that has the visual appearance of a round seal and its visual parameters can be set programmatically.
Every stamp signature can have multiple “stamp lines” with custom text and different line thicknesses, colors, font weights and sizes. Here is an example of how a stamp signature created with GroupDocs.Signature for Python via .NET may look like:
GroupDocs.Signature provides the StampSignOptions class to specify different options for Stamp signature:
Stamp type - Round or Square;
Height and width in pixels;
Alignment and position within the document page;
and many more.
Each Stamp option contains inner and outer lines. Inner lines represent horizontal lines of text inside the stamp, while outer lines represent circles (or rectangles based on stamp type) around the stamp with their own text, border settings, background etc.
Here are the steps to add a Stamp signature to a document with GroupDocs.Signature:
Create a new instance of the Signature class and pass the source document path as a constructor parameter.
Instantiate the StampSignOptions object according to your requirements and specify appropriate options.
This example shows how to add a Stamp signature to a document using Python:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportStampSignOptionsfromgroupdocs.signature.domainimportStampLinefromgroupdocs.pydrawingimportColordefsign_with_stamp_signature():withSignature("sample.docx")assignature:# Create stamp signature optionsoptions=StampSignOptions()# Set stamp position and sizeoptions.left=380options.top=520options.width=160options.height=160# Outer line: a ring of text around the stampouter_line=StampLine()outer_line.text=" * European Union * European Union * European Union *"outer_line.font.size=12outer_line.height=22outer_line.text_bottom_intent=6outer_line.text_color=Color.white_smokeouter_line.background_color=Color.dark_slate_blueoptions.outer_lines.append(outer_line)# Inner line: a horizontal line of text inside the ringinner_line=StampLine()inner_line.text="John"inner_line.text_color=Color.medium_violet_redinner_line.font.size=20inner_line.font.bold=Trueinner_line.height=40options.inner_lines.append(inner_line)# Sign the document and save the resultresult=signature.sign("signed_stamp.docx",options)print(f"Signed with {len(result.succeeded)} stamp signature(s)")if__name__=="__main__":sign_with_stamp_signature()
sample.docx is the sample file used in this example. Click here to download it.
Here’s an example showing how to create a more complex stamp signature with multiple lines and custom styling. It draws a square stamp instead of the default round one, and repeats the text of each outer line to fill the whole frame:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportStampSignOptionsfromgroupdocs.signature.domainimportStampLine,StampTextRepeatType,StampTypesfromgroupdocs.pydrawingimportColordefcreate_stamp_line(text,font_size,height,text_color):line=StampLine()line.text=textline.font.size=font_sizeline.font.bold=Trueline.height=heightline.text_color=text_colorreturnlinedefsign_with_stamp_signature_advanced():withSignature("sample.docx")assignature:options=StampSignOptions()# Set stamp position, size and typeoptions.left=340options.top=480options.width=220options.height=160options.stamp_type=StampTypes.SQUARE# Two outer lines: frames of repeated text around the stampfortext,font_size,heightin((" APPROVED *",11,22),(" 2026 *",9,18)):line=create_stamp_line(text,font_size,height,Color.white)line.background_color=Color.dark_blueline.text_bottom_intent=4line.text_repeat_type=StampTextRepeatType.FULL_TEXT_REPEAToptions.outer_lines.append(line)# Two inner lines of text in the middle of the stampoptions.inner_lines.append(create_stamp_line("John Smith",16,32,Color.dark_blue))options.inner_lines.append(create_stamp_line("CEO",12,24,Color.dark_blue))result=signature.sign("signed_stamp_advanced.docx",options)print(f"Signed with {len(result.succeeded)} stamp signature(s)")if__name__=="__main__":sign_with_stamp_signature_advanced()
sample.docx is the sample file used in this example. Click here to download it.
This guide explains how to apply stamp-based signatures to documents using GroupDocs.Signature for Python via .NET. It covers the process of creating a stamp signature, customizing its appearance, and positioning it on the document. The signed document can then be saved with the stamp signature applied.
More Resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: