从itext中读取pdf

时间:2011-09-27 09:43:34

标签: java pdf itext

我在java web应用程序中使用文本制作了一个pdf表格。

PDF生成的是:

性别|第1栏|第2栏|第3栏


男| 1845年| 645 | 254

女性| 214 | 457 | 142

在阅读pdf时,我使用以下代码:

ArrayList allrows = firstable.getRows();

    for (PdfPRow currentrow:allrows) {
        PdfPCell[] allcells = currentrow.getCells(); 
        System.out.println("CurrentRow ->"+currentrow.getCells());
        for(PdfPCell currentcell : allcells){
            ArrayList<Element> element = (ArrayList<Element>) currentcell.getCompositeElements();
            System.out.println("Element->"+element.toString());
        }
    }

如何从pdf列中读取文本并传递给int变量?

1 个答案:

答案 0 :(得分:0)

为什么不将pdf列作为字段生成,以便阅读更容易

相关问题