Wanting to use grapecity for creating pdf files on a web application

Posted by: matovu.anthony on 23 April 2023, 2:13 pm EST

    • Post Options:
    • Link

    Posted 23 April 2023, 2:13 pm EST - Updated 23 April 2023, 2:41 pm EST

    Dear sir,

    I am trying out is i can use grapecity for Java to create pdf files (invoice) on a web application. my first trials i am getting message

    java.lang.ClassNotFoundException: com.grapecity.documents.excel.Workbook

    Help please

    Anthony

  • Posted 24 April 2023, 5:28 am EST - Updated 24 April 2023, 6:05 am EST

    Hi,

    Thanks for reaching out to us with your query.

    You can easily create a Pdf file through an Excel document using GCExcel library.

    public class Main 
    {
        public static void main(String[] args) throws Exception {
        // Create a new workbook
        Workbook workbook = new Workbook();
        // Open an excel file
        InputStream fileStream = new FileInputStream("EmployeeData.xlsx");
        workbook.open(fileStream);
        // Save to an pdf file
        workbook.save("ConvertExcelToPDF.pdf");
     }

    To resolve these type of errors, make sure all dependencies are added to the project. You can refer here: for all GCExcel Java dependencies: https://www.grapecity.com/documents-api-excel-java/docs/online/getting-started.html

    Please refer the working GCExcel Java sample to create Pdf through an Excel document:

    ConvertExcelToPDF_java.zip

    You can get back to us if you face any other issues.

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels