Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

How to copy the text from pdf and paste? 7 years 3 months ago #11701

  • rachnasagar
  • rachnasagar's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 69
  • Thank you received: 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 ?

Please Log in or Create an account to join the conversation.

How to copy the text from pdf and paste? 7 years 3 months ago #11703

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
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);
}

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum