tikaondotnet icon indicating copy to clipboard operation
tikaondotnet copied to clipboard

Can we extract text from word page by page

Open Anupam750 opened this issue 7 years ago • 8 comments

please explain, How can i get text from pdf, word page by page?

Anupam750 avatar Nov 05 '18 11:11 Anupam750

Look at the unit tests. 🤗

KevM avatar Nov 07 '18 14:11 KevM

I‘m also interested in this (but for PDFs). I guess you mean tikaondotnet/src/TikaOnDotNet.Tests/text_extraction.cs, right? I couldn‘t find an example for that.

bugybunny avatar Nov 08 '18 10:11 bugybunny

I have also checked it and did not found anything related to page in code as you said..

Anupam750 avatar Nov 08 '18 12:11 Anupam750

Not sure I follow what you are trying to do. Can you tell me more detail about what you need?

There are examples of text extraction against many file types in the tests.

Kevin Miller @kevm On Nov 8, 2018, 6:43 AM -0600, Anupam750 [email protected], wrote:

I have also checked it and did not found anything related to page in code as you said.. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

KevM avatar Nov 08 '18 17:11 KevM

We want to extract the text of a .pdf or .docx (or .doc dunno, I can’t speak for Anupam75) page by page. I currently just use new TextExtractor().Extract(filename.pdf) .Text to get the text from a PDF. But I would love to know where the page breaks are. I somewhere read that PDFBox outputs a <br> at the beginning of each page but I don’t know what method I need to call to get this behaviour from Tika/TikaOnDotNet.

bugybunny avatar Nov 11 '18 19:11 bugybunny

I don't believe that is an option that Tika offers. Tika is a high level abstraction. If you wanted to do that more precisely I would look at using POI directly. https://poi.apache.org/text-extraction.html

KevM avatar Nov 13 '18 13:11 KevM

Can you make something out of this answer? https://stackoverflow.com/a/6271696/4040068

I thought that it’s not possible and I know that Tika is just an abstraction layer to get the content from so many different formats. I have to use .NET (so PDFBox itself is not an option, there’s a PDFBox with IKVM but it’s not maintained anymore) and TikaOnDotNet was the only pdf extraction tool that I can use concerning the license and doesn’t cost a lot of money. So I was hoping I can still use it for a bit more than just plain extraction, but it’s not really a problem :)

bugybunny avatar Nov 14 '18 10:11 bugybunny

You might be able to hook into Tika to get the raw markup. Not sure. Let me know what you find out.

KevM avatar Nov 15 '18 14:11 KevM