KevM / tikaondotnet

Use the Java Tika text extraction library on the .NET platform
http://kevm.github.io/tikaondotnet/
Apache License 2.0
195 stars 73 forks source link

Can we extract text from word page by page #129

Open Anupam750 opened 5 years ago

Anupam750 commented 5 years ago

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

KevM commented 5 years ago

Look at the unit tests. 🤗

bugybunny commented 5 years ago

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.

Anupam750 commented 5 years ago

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

KevM commented 5 years ago

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 notifications@github.com, 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.

bugybunny commented 5 years ago

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.

KevM commented 5 years ago

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

bugybunny commented 5 years ago

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 :)

KevM commented 5 years ago

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