GroupDocs.Signature provides with SignOptions property Extensions that expects list of different extensions classes. At this moment here are few of them
SpreadsheetPosition that allows to specify for Spreadsheet documents signature position as Row and Column numbers
TextShadow alternative extension for Text signature property
Here are the steps to add extensions to signature into document with GroupDocs.Signature:
Create new instance of Signature class and pass source document path as a constructor parameter.
Instantiate the SignOptions object with all required additional options.
This example shows how to add Text signature to document.
Signaturesignature=newSignature("sample.pdf");TextSignOptionsoptions=newTextSignOptions("John Smith");// set signature position
options.setLeft(100);options.setTop(100);// set signature rectangle
options.setWidth(100);options.setHeight(30);// set signature alignment
// when VerticalAlignment is set the Top coordinate will be ignored.
// Use Margin properties Top, Bottom to provide vertical offset
options.setVerticalAlignment(VerticalAlignment.Top);// when HorizontalAlignment is set the Left coordinate will be ignored.
// Use Margin properties Left, Right to provide horizontal offset
options.setHorizontalAlignment(HorizontalAlignment.Right);Paddingpadding=newPadding();padding.setBottom(20);padding.setRight(20);options.setMargin(padding);// adjust signature appearance
// setup signature border
Borderborder=newBorder();border.setColor(Color.GREEN);border.setDashStyle(DashStyle.DashLongDashDot);border.setTransparency(0.5);border.setVisible(true);border.setWeight(2);options.setBorder(border);// set text color and Font
options.setForeColor(Color.RED);SignatureFontsignatureFont=newSignatureFont();signatureFont.setSize(12);signatureFont.setFamilyName("Comic Sans MS");options.setFont(signatureFont);// setup background
Backgroundbackground=newBackground();background.setColor(Color.LIGHT_GRAY);background.setTransparency(0.5);background.setBrush(newLinearGradientBrush(Color.GREEN,Color.DARK_GRAY,0));options.setBackground(background);// set rotation
options.setRotationAngle(45);// set alternative signature implementation on document page
options.setSignatureImplementation(TextSignatureImplementation.Image);// set up shadow options for text
TextShadowshadow=newTextShadow();shadow.setColor(Color.ORANGE);shadow.setAngle(135);shadow.setBlur(5);shadow.setDistance(4);shadow.setTransparency(0.2);//add text shadow to signature extensions
options.getExtensions().add(shadow);// sign document to file
SignResultsignResult=signature.sign("signed.pdf",options);// analyzing result
System.out.print("List of newly created signatures:");intnumber=1;for(BaseSignaturetemp:signResult.getSucceeded()){System.out.print("Signature #"+number+++": Type: "+temp.getSignatureType()+" Id:"+temp.getSignatureId()+",Location: "+temp.getLeft()+"x"+temp.getTop()+". Size: "+temp.getWidth()+"x"+temp.getHeight());}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
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.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.