We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Need Java Create /Validate PDF digital signature sample

Good Morning,

I have download the trail version of "aspose-pdf-kit-4.6.0-java" forlder for PDF creation and signature validation. There is no Java files available in this KIT.

Could you please share the download link for the same to try the samples.

Thanks in Advance.


Babu S.

Hi Babu,

Thanks for contacting support.

In order to add digital signature to existing PDF file using Aspose.Pdf.Kit for Java, please try using the following code snippet.


//create PdfFileSecurity object and
bind input and output files

String inputFile = "c:/pdftest/EMF_test.pdf";

String certificateFile = "c:/pdftest/VirtualCabinetPortal.pfx"; ;

com.aspose.pdf.kit.PdfFileSignature pFileSignature = new com.aspose.pdf.kit.PdfFileSignature();

//create Signature object

com.aspose.pdf.kit.Signature sgn = new com.aspose.pdf.kit.Signature();



sgn.setReason("conform myself");

sgn.setRect(new java.awt.Rectangle(100, 100, 200, 200));


//sign PDF file










java.io.FileOutputStream outStream = new java.io.FileOutputStream("c:/pdftest/Signature_output.pdf");


Hi Babu,

Adding more to my previous comments, please note that since April-2013, Aspose.Pdf.Kit for Java has been merged into Aspose.Pdf for Java and the release of Aspose.Pdf.Kit for Java as a separate component will be discontinued in Q3-2013. However the current release of Aspose.Pdf for Java cannot sign PDF document using code snippet shared earlier. The problem is logged as PDFNEWJAVA-33589 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction.

You may consider visiting the following links for further details on

  • [Autoporting Aspose.Pdf for .NET to Java](https://blog.aspose.com/2013/03/23/auto-ported-version-of-aspose.pdf-for-.net-to-java-platform)
  • [Aspose.Pdf for Java and Aspose.Pdf.Kit for Java have Merged](https://blog.aspose.com/2013/05/03/aspose.pdf-for-java-and-aspose.pdf.kit-for-java-have-merged)
  • [First Release of Autoported Aspose.Pdf for Java](https://blog.aspose.com/2013/04/28/first-release-of-autoported-aspose.pdf-for-java)
  • [Structure of Autoported Aspose.Pdf for Java](https://blog.aspose.com/2013/04/07/jump-start-about-autoported-aspose.pdf-for-java)

Hi Babu,

Thanks for your patience.

We are pleased to share that the issue PDFNEWJAVA-33589 reported earlier is resolved and its fix will be included in next release of Aspose.Pdf for Java. In order to sign the PDF files, please try using the following code snippet.


String dataDir = “D:\temp\”;<o:p></o:p>

String inputFile = dataDir + "HelloWorld.pdf";

String outSignedFile = dataDir + "out_PDFNEWJAVA_33589.pdf";

PdfFileSignature pFileSignature = new PdfFileSignature();


//adding signature

pFileSignature.sign(1, "conform myself", "", "sydney", true, new java.awt.Rectangle(100, 200, 200, 100), new PKCS1(dataDir + "VirtualCabinetPortal (1).pfx", "password"));

pFileSignature.setSignatureAppearance(dataDir + "im.png");//using signature image

java.io.FileOutputStream outStream = new java.io.FileOutputStream(outSignedFile);


The issues you have found earlier (filed as PDFNEWJAVA-33589) have been fixed in Aspose.Pdf for Java 9.5.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.