privatestaticvoidonSignStarted(Signaturesender,ProcessStartEventArgsargs){System.out.print("Sign process started at "+args.getStarted()+" with "+args.getTotalSignatures()+" total signatures to be put in document");}
Implement method for SignProgress event
privatestaticvoidonSignProgress(Signaturesender,ProcessProgressEventArgsargs){System.out.print("Sign progress. Processed "+args.getProcessedSignatures()+" signatures. Time spent "+args.getTicks()+" mlsec");}
Implement method for SignCompleted event
privatestaticvoidonSignCompleted(Signaturesender,ProcessCompleteEventArgsargs){System.out.print("Sign process completed at "+args.getCompleted()+" with "+args.getTotalSignatures()+" total signatures. Process took "+args.getTicks()+" mlsec");}
Subscribing for signing process events
privatestaticvoidonSignStarted(Signaturesender,ProcessStartEventArgsargs){System.out.print("Sign process started at "+args.getStarted()+" with "+args.getTotalSignatures()+" total signatures to be put in document");}privatestaticvoidonSignProgress(Signaturesender,ProcessProgressEventArgsargs){System.out.print("Sign progress. Processed "+args.getProcessedSignatures()+" signatures. Time spent "+args.getTicks()+" mlsec");}privatestaticvoidonSignCompleted(Signaturesender,ProcessCompleteEventArgsargs){System.out.print("Sign process completed at "+args.getCompleted()+" with "+args.getTotalSignatures()+" total signatures. Process took "+args.getTicks()+" mlsec");}/**
* Sign document with text signature applying specific options
*/publicstaticvoidrun(){try{Signaturesignature=newSignature("sample.pdf");signature.SignStarted.add(newProcessStartEventHandler(){publicvoidinvoke(Signaturesender,ProcessStartEventArgsargs){onSignStarted(sender,args);}});signature.SignProgress.add(newProcessProgressEventHandler(){publicvoidinvoke(Signaturesender,ProcessProgressEventArgsargs){onSignProgress(sender,args);}});signature.SignCompleted.add(newProcessCompleteEventHandler(){publicvoidinvoke(Signaturesender,ProcessCompleteEventArgsargs){onSignCompleted(sender,args);}});TextSignOptionsoptions=newTextSignOptions("John Smith");// set signature position
options.setLeft(100);options.setTop(100);signature.sign("signed.pdf",options);System.out.print("\nSource document signed successfully.\nFile saved at "+outputFilePath);}catch(Exceptione){thrownewGroupDocsSignatureException(e.getMessage());}}
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.