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

Free Support Forum - aspose.com

Can't sign

Hi,

We are having a nullpointerexception at save method. We convert a docx to PDF and then we try to sign the pdf file. Converting docx to PDF is ok but we have troubles at signing.

We use this code to do that:

documento.save("/home/tmp/aspose.pdf");

Signature sgn = new Signature();
sgn.setLocation(“Lima”);
sgn.setName(“Omar”);
sgn.setReason(“Alguna razon”);
sgn.setRect(new java.awt.Rectangle(200, 500, 150, 150));
try {
PdfFileSignature pdfSign = new PdfFileSignature();
InputStream fileStream = new FileInputStream("/home/tmp/aspose.pdf");
pdfSign.bindPdf(fileStream);
pdfSign.setCertificateFile("/home/tempo/analista.pfx");
pdfSign.setSignModel(PdfFileSignature.SELF);
pdfSign.setPageNumber(1);
pdfSign.setPassword(“12345”);
pdfSign.setSignature(sgn);
pdfSign.save("/home/tmp/asposesigned.pdf");
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(“NO SE PUEDE FIRMAR”);
}

NullPointerException occurs in the line “pdfSign.save(”/home/tmp/asposesigned.pdf");"

asposesigned.pdf is created but corrupted or damaged and we can’t open it.

Thanks for your help

Hello Rafael,

Thanks for using our products.

Can you please share the source PDF document (after conversion from DOCX) and the signature file that you are using so that we can test the scenario at our end. We apologize for your inconvenience.

Hi,

Here are the files.

Hi Rafael,

Thank you very much for sharing the PDF and PFX files with us. We’re looking into this issue at our end and you’ll be updated with the results the earliest possible.

Regards,

Hi,

Any news about the problem? Any comment would be appreciated. Thanks.

Hi Rafael,

I have reproduced this problem at my end and logged it as PDFKITJAVA-28048 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,