GroupDocsGists
10/24/2017 - 1:10 PM

Examples-src-main-java-com-groupdocs-signature-examples-ImageSignature-signPdfDocWithImage.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
PdfSignImageOptions signOptions = new PdfSignImageOptions(CommonUtilities.getImagesPath("sign.png"));
// image position
signOptions.setLeft(100);
signOptions.setTop(100);
signOptions.setWidth(100);
signOptions.setHeight(100);
signOptions.setDocumentPageNumber(1);
final SaveOptions saveOptions = new SaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setOutputFileName("signed_output.pdf");
// sign document
String signedPath = handler.<String>sign(CommonUtilities.getStoragePath(fileName), signOptions, saveOptions);
System.out.println("Signed file path is: " + signedPath);