RadaeePDF.com :: Topic: How to copy the text from pdf and paste? (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: How to copy the text from pdf and paste?

How to copy the text from pdf and paste? 3 months 2 weeks ago #11701

  • rachnasagar
  • rachnasagar's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 67
  • Karma: 0
How to copy the text from pdf and paste any where or in notes?

I have tried many times but its not possible to copy from pdf and paste any where ?
The administrator has disabled public write access.

How to copy the text from pdf and paste? 3 months 2 weeks ago #11703

  • Davide
  • Davide's Avatar
  • OFFLINE
  • Moderator
  • Posts: 656
  • Thank you received: 43
  • Karma: 11
Hi,
you can select the text by using the 4th button of the pdf toolbar, then in the dialog select "Copy text to clipboard".
In the java code you will get the selected text in OnPDFSelectEnd method of PDFViewAct class, to copy it to clipboard you have to add the following code in that method after the first if( rad_group.getCheckedRadioButtonId() == R.id.rad_copy ) :
if( rad_group.getCheckedRadioButtonId() == R.id.rad_copy )
{
	Toast.makeText(PDFViewAct.this, "todo copy text:" + sel_text, Toast.LENGTH_SHORT).show();
	android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
	android.content.ClipData clip = android.content.ClipData.newPlainText("Radaee", sel_text);
	clipboard.setPrimaryClip(clip);
}
The administrator has disabled public write access.
Powered by Kunena Forum