File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes How to extract text from a pdf file in android emulator Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "How to extract text from a pdf file in android emulator" Watch "How to extract text from a pdf file in android emulator" New topic
Author

How to extract text from a pdf file in android emulator

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

i have tried the following code to extract text from pdf file on android.



it works when the file is in the file-system,but i want it to work ,when the file is in the sdcard
something similar to this:


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35249
    
    7
For starters, PDF files are binary, not text. That means you can't use Readers to work with them, you need to use Streams.

So the actual problem is how to get an InputStream from a file on the SD card? The Android Dev Guide has a page called "Data Storage" that talks about using SD cards.


Android appsImageJ pluginsJava web charts
Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

FileReader doesnot works for pdf files.
please,tell me how to use pdfbox within the android
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35249
    
    7
FileReader doesnot works for pdf files.

Not just FileReader - all Readers and Writers. It's crucial that you understand the difference between text files and binary files.

please,tell me how to use pdfbox within the android

I have no idea whether PDFBox works on Android, but I pointed you to a resource that explains how to get an InputStream from a file on an SD card, and it seems that PDDocument.load can use an InputStream as well as a Reader. What else are you looking for?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to extract text from a pdf file in android emulator
 
Similar Threads
PDFTextStripper returning null for all the japanese text in the PDF
How to get the complete path of file from android application
Unable to read more than one text files stored in sdcard
JTextPane ignoring new lines when text is loaded from servlet