Hi,
Hi Karambir,
// Source PDF file<o:p></o:p>
Document pdfDocument = new Document(myDir + "asset_102826BuffaloDippingSauceK12.pdf");
TableAbsorber absorber = new TableAbsorber();
// Visit first page with absorber
for (int pages = 1; pages <= pdfDocument.Pages.Count; pages++)
{
absorber.Visit(pdfDocument.Pages[pages]);
// Get access to first table on page, their first cell and text fragments in it
//iterate through each table of pdf
for (int i = 0; i < absorber.TableList.Count; i++)
{
//iterate through each row of table
for (int j = 0; j < absorber.TableList[i].RowList.Count; j++)
{
//iterate through each cell of row
for (int k = 0; k < absorber.TableList[i].RowList[j].CellList.Count; k++)
{
//iterate through each cell to extract data
if (absorber.TableList[i].RowList[j].CellList[k].TextFragments.Count > 0)
{
//TextFragment fragment = absorber.TableList[i].RowList[j].CellList[k].TextFragments[1];
var textFragmentCollection = absorber.TableList[i].RowList[j].CellList[k].TextFragments;
string s = null;
foreach (TextFragment fragment in textFragmentCollection)
{
s = s + fragment.Text;
}
Console.WriteLine("Table {0},Row {1}, Cell {2},Text: {3}", i, j, k, s);
}
}
}
}
}
Please feel free to contact us for any further assistance.
Best Regards,
Hi,
Hi Karambir,
Hello! I am doing exactly the process you describe above, however, the table absorber is only seeing 3 or 4 fragments of the cells. I have cells where I can manually count 10 fragments but it only reads the first 3 or 4. Any suggestions?
Are you using a valid or 30-days free temporary license? Please share your sample PDF so that we can test the scenario in our environment and address it accordingly.
I am using a full license I purchased today. This problem was solved with the full problem but a new problem arised and I created a case for it and attached pdf. Thank you for your response!