GroupDocsGists
10/24/2017 - 1:10 PM

Examples-src-main-java-com-groupdocs-signature-examples-OtherOperations-setUpBackgroundAndBorderOptions.java

// For complete examples and data files, please go to https://github.com/groupdocs-signature/GroupDocs.Signature-for-Java
// setup Signature configuration
SignatureConfig signConfig = CommonUtilities.getConfiguration();
// instantiating the conversion handler
SignatureHandler<String> handler = new SignatureHandler<String>(signConfig);
// setup image signature options with relative path - image file stores in config.ImagesPath folder
WordsSignTextOptions signOptions = new WordsSignTextOptions("John Smith");
// setup background settings
signOptions.setBackgroundColor(Color.GRAY);
signOptions.setBackgroundTransparency(0.5);
// setup border settings
signOptions.setBorderColor(Color.BLACK);
signOptions.setBorderDashStyle(ExtendedDashStyle.DashDot);
signOptions.setBorderWeight(1.2);
signOptions.setBorderTransparency(0.5);
final SaveOptions saveOptions = new SaveOptions();
saveOptions.setOutputType(OutputType.String);
// sign document
String signedPath = handler.<String>sign(CommonUtilities.getStoragePath(fileName), signOptions, saveOptions);
System.out.println("Signed file path is: " + signedPath);