How to convert PDF to text file in iTextSharp

后端 未结 3 930
时光说笑
时光说笑 2021-01-05 10:08

I have to retrieve text from PDF file. But using the following code I only get empty text file.

for (int i = 0; i < n; i++)
{
    pagenumber = i + 1;
            


        
3条回答
  •  Happy的楠姐
    2021-01-05 11:01

    For text extraction with iTextSharp, take a current version of that library and use

    PdfTextExtractor.GetTextFromPage(reader, pageNumber);
    

    Beware, there is a bug in the text extraction code in some 5.3.x version which has meanwhile been fixed in trunk. You, therefore, might want to checkout the trunk revision.

提交回复
热议问题