Analyze SignResult result to check newly created signatures if needed.
This example shows how to add QR-Code signature to document.
Signaturesignature=newSignature("sample.xlsx");// create QRCode option with predefined QRCode text
QrCodeSignOptionssignOptions=newQrCodeSignOptions("12345678");// setup QRCode encoding type
signOptions.setEncodeType(QrCodeTypes.QR);// set signature position
signOptions.setLeft(100);signOptions.setTop(100);// set signature alignment
// when VerticalAlignment is set the Top coordinate will be ignored.
// Use Margin properties Top, Bottom to provide vertical offset
signOptions.setVerticalAlignment(VerticalAlignment.Top);// when HorizontalAlignment is set the Left coordinate will be ignored.
// Use Margin properties Left, Right to provide horizontal offset
signOptions.setHorizontalAlignment(HorizontalAlignment.Right);Paddingpadding=newPadding();padding.setRight(20);padding.setTop(20);signOptions.setMargin(padding);// adjust signature appearance
// setup signature border
Borderborder=newBorder();border.setColor(Color.GREEN);border.setDashStyle(DashStyle.DashLongDashDot);border.setWeight(2);border.setTransparency(0.5);border.setVisible(true);signOptions.setBorder(border);// set text color and Font
signOptions.setForeColor(Color.RED);SignatureFontfont=newSignatureFont();font.setSize(12);font.setFamilyName("Comic Sans MS");signOptions.setFont(font);// setup background
Backgroundbackground=newBackground();background.setColor(Color.GREEN);background.setTransparency(0.5);background.setBrush(newLinearGradientBrush(Color.GREEN,Color.DARK_GRAY,0));signOptions.setBackground(background);// sign document to file
SignResultsignResult=signature.sign("sampleSigned.xlsx",signOptions);// 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. E
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.