Skip to main content
Participant
December 27, 2020
Question

Select a field and copy to clipboard

  • December 27, 2020
  • 2 replies
  • 2001 views

In my PDF form I have combined a few text fields value and display in another text field (Fieldname-26). 

I need to select this field and copy to the clipbroad so that I can paste it to another application. 

Can I do it in JS ?   I am new to JS.  Thanks in advance

 

 

This topic has been closed for replies.

2 replies

junaidk60059054
Known Participant
December 28, 2020

function myFunction() {
  /* Get the text field */
  var copyText = document.getElementById("myInput");

  /* Select the text field */
  copyText.select();
  copyText.setSelectionRange(099999); /* For mobile devices */

  /* Copy the text inside the text field */
  document.execCommand("copy");

  /* Alert the copied text */
  alert("Copied the text: " + copyText.value);
}

Bernd Alheit
Community Expert
Community Expert
December 28, 2020

This function will not work in Adobe Acrobat or Acrobat Reader!

eddie0D45Author
Participant
December 29, 2020

Corrrect. I have tried that. It does not work on PDF form.

Inspiring
December 27, 2020

No, Adobe removed this security vulnerability a long time ago, back in Acrobat 4 or 5.

eddie0D45Author
Participant
December 27, 2020

Thanks for the reply.  I have to highlight the content, copy and paste manually.