Q. Is it possible to extract text from pdf per line in iText?
A. PDF is based on a charting system (X,Y co-ordinates) Thus all PDF writers and reader's are based on "area by area". Such that the smallest single unit is in effect each page not the lines of text that can be in any angle or order.
Thus to be forced to work "Line-wise" there would need to be named functions or switches. Certainly iText could do that as per other answers. But for simplicity I propose in basic cases try PDFtoText first. That way you can pick from newly numbered lines.
So for the first 31 lines of this page.
pdftotext -layout -enc UTF-8 pdftext.pdf|find /v /n "uhhlfdhh" pdftext.txt
---------- PDFTEXT.TXT
[1]PDF text extraction using iText
[2]Asked 12 years, 7 months ago Modified today Viewed 54k times
[3]
[4]
[5]
[6] We are doing research in information extraction, and we would like to use iText.
[7]
[8] We are on the process of exploring iText. According to the literature we have reviewed, iText is
[9] 14
[10] the best tool to use. Is it possible to extract text from pdf per line in iText? I have read a
[11] question post here in stackoverflow related to mine but it just read text not to extract it. Can
[12] anyone help me with my problem? Thank you.
[13]
[14]
[15] itext Edit tags
[16]
[17]
[18]
[19] Share Edit Follow Close Flag edited Jan 11, 2012 at 21:12 asked Jan 11, 2012 at 14:40
[20] Kieran rogelie
[21] 3,756 4 29 39 141 1 1 3
[22]
[23]
[24]
[25]
[26] 3 I'm not completely clear on what you are doing. Reading text and extracting text are generally the
[27] same thing. iText won't save the text to a file for you but once you have the text you should be able
[28] to do that fairly easily. iText does a really great job of extracting text as long as it is actually text (not
[29] outlines or bitmaps). When searching this site also look for iTextSharp which is the .Net port of
[30] iText. It has more questions/answers and the code is almost completely the same for C#.
[31] – Chris Haas Jan 11, 2012 at 19:01
iTextSharpwhich is the .Net port of iText. It has more questions/answers and the code is almost completely the same for C#.