Loading Excel file and saving as signed PDF using JAVA

Hi,

We are reviewing ASPOSE CELLS for the cloud API & would like to know what is the best way to load excel, upgrade and save it as a signed PDF document.

I have seen in Aspose Cells the ability to add a signature to an excel file, but what about the ability to create signature in pdf document? This is what the example code looks like with the element I would like to achieve:

    Workbook workbook = new Workbook("File.xlsx");

    Worksheet worksheet = workbook.getWorksheets().get(0);

    Cells cells = worksheet.getCells();
    Cell cell = cells.get(1, 1);
    cell.putValue(100);

    workbook.getWorksheets().setActiveSheetIndex(0);
    worksheet.setActiveCell("B2");
    worksheet.setFirstVisibleColumn(1);
    worksheet.setFirstVisibleRow(1);

    String FILE_PATH = "Keystore.pkx";
    DigitalSignatureCollection signatures = new DigitalSignatureCollection();
    InputStream inStream = new FileInputStream(FILE_PATH);
    KeyStore inputKeyStore = KeyStore.getInstance("PKCS12");
    String KEYSTORE_PASSWORD = "password";
    inputKeyStore.load(inStream, KEYSTORE_PASSWORD.toCharArray());
    DigitalSignature signature = new DigitalSignature(inputKeyStore, KEYSTORE_PASSWORD, "test for  sign",
            DateTime.getNow());

    signatures.add(signature);
    workbook.setDigitalSignature(signatures);

    workbook.save("signed_example.pdf", FileFormatType.PDF); // Here I would like save a signed PDF Document

Do I need to use the Aspose PDF library in addition…? If so, is there any way to convert an object of the Workbook class to the (probably) Document class…?

I would be very grateful for your help

Thanks
Patryk

@Jarema6,

First, convert an Excel file to a PDF file, and then digitally sign PDF files with PDF libraries.

About Converting Excel to PDF, you can refer to online documents.

Thank you very much for your help!

All the best

@Jarema6,

Feel free to contact us any time if you have further comments or questions.