iTextsharp read table data RRS feed

  • Question

  • User-1471881183 posted

    hi there,

    i need to read a pdf file, there is a table, to read that i used below function, it is working good but, i cant find column wise data because, the output is coming like this

    "\n Gourav Hall Junior School LEIGH-ON-SEA, Essex Gourav Hall Junior School PB  SS9 3NL  0 Business Phone Nu 475444\n " so, i cant find which is next column value, is there any way to find it?

    public static string[] getParagraphByCoOrdinate(string filepath, int pageno, int cordinate1, int coordinate2, int coordinate3, int coordinate4)
    PdfReader reader = new PdfReader(filepath);
    iTextSharp.text.Rectangle rect = new iTextSharp.text.Rectangle(cordinate1, coordinate2, coordinate3, coordinate4);
    RenderFilter[] renderFilter = new RenderFilter[1];
    renderFilter[0] = new RegionTextRenderFilter(rect);
    ITextExtractionStrategy textExtractionStrategy = new FilteredTextRenderListener(new LocationTextExtractionStrategy(), renderFilter);
    string text = PdfTextExtractor.GetTextFromPage(reader, pageno, textExtractionStrategy);
    string[] words = text.Split('\n');
    return words;

    Friday, May 15, 2015 11:53 AM

All replies