Excel to PDF in Java – JAR Files

In the previous part, we explained how to generate a simple HTML form that is capable of accepting an user uploaded XLS file and post it to a Java servlet and generate PDF. In this part, we will identify all the required Java libraries that will support the servlet code. You will require a number of JAR files and I have provided a table of JAR files that you must have in your classpath for the example to work.

XLS to PDF – Required JAR Files


Listed below are the JAR files that is required for the entire tutorial:

JAR File
Use
poi-3.8.jar
This file is required to handle .XLS files uploaded to the servlet.
commons-fileupload-1.2.2.jar
This JAR file supports reading the form data including the uploaded file.
commons-io-2.4.jar
This JAR files supports methods that generate InputStream of the uploaded Excel file.
servlet-api.jar
Core servlet API shipped with TomCat, to support the servlet code completely.
itextpdf-5.3.4.jar
JAR files in this library converts the XLS / XLSX file data to PDF.
poi-ooxml-3.8.jar
You need this to support XLSX format. (Open Office XML format ).Part of POI library.
poi-excelant-3.8.jar
Required for XLSX format handling.Part of POI library.
xmlbeans-2.3.0.jar
Required to handle XLSX format. Part of POI library.
dom4j-1.6.1.jar
To parse XLSX format. Part of POI library.
poi-ooxml-schemas-3.8.jar
Read XLSX file schemas

You don’t need to search for these JAR files across the internet. All you need to do is download POIv3.8, iText 5.3.4, and TomCat. You can find all the JAR files in them.

Once you have a copy of all the JAR files, make sure you copy them to your CLASSPATH.
If you have all the required files ready, you can move to the next part of this tutorial => Complete Java Servlet Program. Refer links below for navigation assistance.
This Tutorial Series: Convert Excel to PDF – Java Servlet Example
Keywords: Excel to PDF, Java Servlet, Apache POI, Itext, Convert XLS to PDF Example
All parts:
1. HTML Form Design to support XLS to PDF Conversion.
2. JAR Files required for conversion and their use.
3. Handling uploaded file in a servlet./ Complete Java code to convert Excel to PDF through a servlet.
4. Servlet Configuration / Testing.

No comments: