I want to open PDF file from locally and then I show the PDF content then if user copy any text then I want to get the copied text. so please suggest me any API or solution related to this problem and the challenging task is to copy text and get it that I want. I have use this code also but its open PDF by using internal app like adobe reader so I don't know that adobe reader give me permission to access copy text.
File file = new File(Environment.getExternalStorageDirectory() + "/test.pdf");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
PDFBox would be your best option considering how easy it is to use. You can have a look at the examples and get going immediately..
EDIT : As @Adinia pointed it out, PDFBox is not working on Android. The reason being PDFBox uses AWT and Swing even for the non-ui related tasks and Android does not support these.
You could have a go at PDFjet and here are some examples to get you started.
EDIT 2: PDFBox-Android (as the name suggests) is now available for Android, as @Theo was so kind to inform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With