A Text electronic signature is an arbitrary text that is added to a document in a native way depending on the type of the document. GroupDocs.Signature provides the text signature feature and allows customizing a wide range of text settings - from font name, size and color to alignment, borders, shadow effects etc. This is how a text signature may look like:
How to eSign Document with Text Signature
Let’s try to add a text signature to a PDF programmatically using Python.
This example shows how to add a text signature to a document using Python:
importgroupdocs.signatureassignaturefromgroupdocs.signature.optionsimportTextSignOptionsfromgroupdocs.signature.domainimportSignatureFont,TextSignatureimportgroupdocs.signature.domainasgsdimportsysimportosdefrun():withsignature.Signature("./sample.pdf")assign:# Create text signature optionstext_options=TextSignOptions("John Smith")# Set advanced optionstext_options.font=gsd.SignatureFont()text_options.font.size=20text_options.font.family_name="Arial"text_options.font.bold=Truetext_options.font.italic=Truetext_options.fore_color=gsd.Color.BLUEtext_options.back_color=gsd.Color.WHITEtext_options.opacity=0.8text_options.rotation_angle=45# Set text alignmenttext_options.horizontal_alignment=gsd.HorizontalAlignment.CENTERtext_options.vertical_alignment=gsd.VerticalAlignment.CENTER# Add bordertext_options.border_color=gsd.Color.BLACKtext_options.border_style=gsd.DashStyle.SOLIDtext_options.border_width=2# Sign documentsign.sign("./sample_signed.pdf",text_options)
Advanced Text Signature Options
You can customize the text signature further with additional options:
importgroupdocs.signatureassignaturefromgroupdocs.signature.optionsimportTextSignOptionsfromgroupdocs.signature.domainimportSignatureFont,TextSignatureimportgroupdocs.signature.domainasgsdimportsysimportosdefrun():withsignature.Signature("./sample.pdf")assign:# Create text signature optionstext_options=TextSignOptions("John Smith")# Set advanced optionstext_options.font=gsd.SignatureFont()text_options.font.size=20text_options.font.family_name="Arial"text_options.font.bold=Truetext_options.font.italic=Truetext_options.fore_color=gsd.Color.BLUEtext_options.back_color=gsd.Color.WHITEtext_options.opacity=0.8text_options.rotation_angle=45# Set text alignmenttext_options.horizontal_alignment=gsd.HorizontalAlignment.CENTERtext_options.vertical_alignment=gsd.VerticalAlignment.CENTER# Add bordertext_options.border_color=gsd.Color.BLACKtext_options.border_style=gsd.DashStyle.SOLIDtext_options.border_width=2# Sign documentsign.sign("./sample_signed.pdf",text_options)
Summary
This guide explains how to add text-based signatures to documents with GroupDocs.Signature for Python via .NET. It covers configuring text properties such as font, color, size, and position, and applying the text signature to a document. The signed document is then saved with the added text signature.
More Resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: