I introduced how to convert Excel to PDF in Java before, but what if you want to save PDF in Excel? This time, let's show it through Spire.PDF for Java.
1. From the official website of E-iceblue Free Spire.PDF for Java Download the free version.
2. Start the IDE, create a new project, and then add the appropriate Spire.PDF.jar for the installed files to your references.
import com.spire.pdf.FileFormat;
import com.spire.pdf.PdfDocument;
public class ToXLS {
public static void main(String[] args) {
//Create a PdfDocument.
PdfDocument pdf = new PdfDocument();
//Load the PDF file.
pdf.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.pdf");
//Save in Excel.
pdf.saveToFile("output/ToXLS.xlsx", FileFormat.XLSX);
}
}
Recommended Posts