I want to read the text from a PDF file present on the SD card. How can we get text from a PDF file that is stored on an SD card?
I tried:
public class MainActivity extends ActionBarActivity implements TextToSpeech.OnInitListener { private TextToSpeech tts; private String line = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tts = new TextToSpeech(getApplicationContext(), this); final TextView text1 = (TextView) findViewById(R.id.textView1); findViewById(R.id.button1).setOnClickListener(new OnClickListener() { private String[] arr; @Override public void onClick(View v) { File sdcard = Environment.getExternalStorageDirectory();
Note: it works fine if the file is a text file (test.txt) but does not work for pdf (test.pdf)
But here the text is not obtained from PDF as is, it becomes like a byte code. How can I achieve this?
Thanks in advance.
Shylendra madda
source share