GroupDocsGists
10/24/2017 - 8:22 AM

signPDFWithFontAndColorOptions.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 digital verification options
PdfSignTextOptions signOptions = new PdfSignTextOptions("John Smith");
// setup colors settings
signOptions.setBackgroundColor(Color.GRAY);
// setup text color
signOptions.setForeColor(Color.RED);
// setup Font options
signOptions.getFont().setBold(true);
signOptions.getFont().setItalic(true);
signOptions.getFont().setUnderline(true);
signOptions.getFont().setFontFamily("Arial");
signOptions.getFont().setFontSize(15);
final SaveOptions saveOptions = new SaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setOutputFileName("signed_output.pdf");
// sign document
String signedPath = handler.sign(CommonUtilities.getStoragePath(fileName), signOptions, saveOptions);
System.out.println("Signed file path is: " + signedPath);