0

I am using iTextSharp to read PDF content, but when I try to read tables with this library, my data are not sorted well! Could you please suggest me another library or help me to modify the code!

public static string pdfText(string path)
{
    PdfReader reader = new PdfReader(path);
    string text = string.Empty;
    for (int page = 1; page <= 2; page++)
    {
        text += PdfTextExtractor.GetTextFromPage(reader, page);
    }
    var textWithoutEmptyLines = Regex.Replace(text, @"^\s+$[\r\n]*", string.Empty, RegexOptions.Multiline);
    reader.Close();
    return textWithoutEmptyLines;
}
Harshad Raval
  • 73
  • 2
  • 9
Tidra
  • 95
  • 10
  • Have you tried the suggestion from [this answer](https://stackoverflow.com/a/40969471/1729265)? – mkl Aug 05 '21 at 08:25

0 Answers0