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

Free Support Forum - aspose.com

Digital signature pdf - Android

Hi, Does Aspose have methods in Android to digitally sign PDF documents using a PKCS#12 file (a *.pfx or *.p12 file)?



Hi Eliana,

Thanks for contacting support.

You can digitally sign PDF files using Aspose.Pdf for Android. Please try using following code snippet and in case you encounter any issue, please feel free to contact.


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

//Instantiate Document object

com.aspose.pdf.Document doc = new com.aspose.pdf.Document();

//Add a page to PDF document


OutputStream out = new java.io.ByteArrayOutputStream();

//Save document to Stream object


//Create PdfFileSignature instance

com.aspose.pdf.facades.PdfFileSignature pdfSignSingle = new com.aspose.pdf.facades.PdfFileSignature();

//Bind the source PDF by reading contents of Stream

pdfSignSingle.bindPdf(new ByteArrayInputStream(((ByteArrayOutputStream)out).toByteArray()));

//Sign the PDF file using PKCS1 object

pdfSignSingle.sign("Digial Signature", new PKCS1(dataDir + "VirtualCabinetPortal (1).pfx", "password"));

//Set image for signature appearance


//Save final output