Spire.PDF for Java 4.10.2 supports extracting tables from PDF files

2021-10-20 01:56:00

We are happy to announce the release of Spire.PDF for Java 4.10.2. This version supports extracting tables from PDF files, as well as enhances the conversions from PDF to Excel/PDFA2A. In addition, it also fixes the issue occurred in the course of deleting the value of the "keyword" property. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature - Supports extracting tables from PDF files.
PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(inputFile);
StringBuilder builder = new StringBuilder();
//Extract the table
PdfTableExtractor extractor = new PdfTableExtractor(pdf);
PdfTable[] tableLists = null;
for (int pageIndex = 0; pageIndex < pdf.getPages().getCount(); pageIndex++) {
    tableLists = extractor.extractTable(pageIndex);
    if (tableLists != null && tableLists.length > 0) {
        for (PdfTable table : tableLists) {
            int row = table.getRowCount();
            int column = table.getColumnCount();
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < column; j++) {
                    if (j == 0) {
                        builder.append(table.getText(i, j));
                    } else {
                        String text = table.getText(i, j);
                        builder.append(text + " ");
                    }
                }
                builder.append("\r\n");
            }
        }
    }
}
FileWriter fileWriter = new FileWriter(outputFile);
fileWriter.write(builder.toString());
fileWriter.flush();
fileWriter.close();
Bug SPIREPDF-3952 Fixes the issue that the font size was changed after converting PDF to Excel.
Bug SPIREPDF-4653 Fixes the issue that the content was incorrect after converting PDF to PDFA2A.
Bug SPIREPDF-4681 Fixes the issue that the value of the "keyword" property could not be deleted.
Bug SPIREPDF-4691 Fixes the issue that setColorSpace method could not set parameters.
Click the link below to download Spire.PDF for Java 4.10.2: