Call sign method of Signature class instance and the instance of signature options (ImageSignOptions for example) to it.
Locate Signature Area with Stretch Mode
This example shows how to locate signature with stretch mode.
// instantiating the signature object
finalSignaturesignature=newSignature("sample.pdf");// define several signature options of different types and settings
TextSignOptionstextOptions=newTextSignOptions("This is test message");textOptions.setAllPages(true);textOptions.setVerticalAlignment(VerticalAlignment.Top);textOptions.setMargin(newPadding(50));textOptions.setStretch(StretchMode.PageWidth);BarcodeSignOptionsbarcodeOptions=newBarcodeSignOptions("123456");barcodeOptions.setAllPages(true);barcodeOptions.setEncodeType(BarcodeTypes.Code128);barcodeOptions.setVerticalAlignment(VerticalAlignment.Bottom);barcodeOptions.setMargin(newPadding(50));barcodeOptions.setStretch(StretchMode.PageWidth);ImageSignOptionsimageOptions=newImageSignOptions();imageOptions.setAllPages(true);imageOptions.setStretch(StretchMode.PageHeight);imageOptions.setHorizontalAlignment(HorizontalAlignment.Right);imageOptions.setImageFilePath("image.png");// define list of signature options
List<SignOptions>listOptions=newArrayList<SignOptions>();listOptions.add(textOptions);listOptions.add(barcodeOptions);listOptions.add(imageOptions);// sign document to file
SignResultsignResult=signature.sign("signed.pdf",listOptions);// 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.