Hello,
I’m implementing functionality which extracts table from the provided PDF document and saves the table as an image. Below you can find the code snippet:
Page page = doc.getPages().get_Item(1);
TableAbsorber absorber = new TableAbsorber();
absorber.setUseFlowEngine(true);
absorber.visit(page);
AbsorbedTable table = absorber.getTableList().get(0);
page.setCropBox(table.getRectangle());
JpegDevice renderer = new JpegDevice();
renderer.process(page, filePath);
The problem occurs when table has no borders and first and/or last row/column contains no data. For example:
table.pdf (17.1 KB)
In this case table’s rectangle returns table size without empty rows and columns therefore when I crop the PDF document to the table’s rectangle - it does not include whole table:
result.png (6.5 KB)
Aspose.PDF version: 24.6