Copy text to clipboard

Community Beginner ,
Sep 18, 2017

Copy link to clipboard

Copied

I have a PDF form, in which there's a button. When the user presses the button, I need to copy some text (an email address) to the clipboard, so that the user will be able to paste it in other applications. This text can be assumed to be constant (i.e. I can hardwire it in a JS).

I thought about creating a n invisible textfield in the form with the text, and the using selectNthPageWord and app.MenuItem("Copy"). But this works for only one word (an email address is processed as separate words), and also the clipboard seems to be erased once the JS finishes. I need the text to remain there.

Any help, please?

TOPICS
Acrobat SDK and JavaScript

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Copy text to clipboard

Community Beginner ,
Sep 18, 2017

Copy link to clipboard

Copied

I have a PDF form, in which there's a button. When the user presses the button, I need to copy some text (an email address) to the clipboard, so that the user will be able to paste it in other applications. This text can be assumed to be constant (i.e. I can hardwire it in a JS).

I thought about creating a n invisible textfield in the form with the text, and the using selectNthPageWord and app.MenuItem("Copy"). But this works for only one word (an email address is processed as separate words), and also the clipboard seems to be erased once the JS finishes. I need the text to remain there.

Any help, please?

TOPICS
Acrobat SDK and JavaScript

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 18, 2017 0
Most Valuable Participant ,
Sep 19, 2017

Copy link to clipboard

Copied

JS in Acrobat is not capable of doing that.

On Tue, Sep 19, 2017 at 8:52 AM, akyd8807993 <forums_noreply@adobe.com>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2017 0
Community Beginner ,
Sep 19, 2017

Copy link to clipboard

Copied

Any other ideas?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2017 0
Most Valuable Participant ,
Sep 19, 2017

Copy link to clipboard

Copied

You can display the text in an alert window and ask the user to copy it

from there.

On Tue, Sep 19, 2017 at 10:44 AM, akyd8807993 <forums_noreply@adobe.com>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2017 0
Community Beginner ,
Sep 19, 2017

Copy link to clipboard

Copied

Text in an alert box is unselectable. I tried a response box, and the text there can be selectable (and editable, which is regrettable), but when the user selects it and presses Cntrl+C, and the text is copied to the clipboard, it doesn't stay there for long. The clipboard is erased when the response box is closed, and the text is no longer available.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2017 0
Most Valuable Participant ,
Sep 19, 2017

Copy link to clipboard

Copied

Yes, I meant a response box. What you're describing is very strange, and not how it works for me. If I copy text from such a window it will remain in the Clipboard until I copy something else which overwrites it. That is a system-wide setting.

Edit: fixed type-o

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2017 0
Community Beginner ,
Sep 25, 2017

Copy link to clipboard

Copied

Can I upload a sample? I tried to attach a file to this reply, and it doesn't seem to work.

It's not a system-wide behaviour. In other application it works (the info remains in the clipboard after the original application is closed). Only in response boxes in PDFs (as far as I can tell).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2017 0
Adobe Community Professional ,
Sep 26, 2017

Copy link to clipboard

Copied

Yes, I meant a response box. What you're describing is very strange, and now how it works for me. If I copy text from such a window it will remain in the Clipboard until I copy something else which overwrites it. That is a system-wide setting.

I confirm.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 26, 2017 0
Adobe Community Professional ,
Sep 26, 2017

Copy link to clipboard

Copied

Can I upload a sample? I tried to attach a file to this reply, and it doesn't seem to work.

Acrobat : File menu : Send File : Send & Track : Create anonymous link

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 26, 2017 0
Community Beginner ,
Sep 26, 2017

Copy link to clipboard

Copied

Okay, it's here:

Shared Files - Acrobat.com

When I open in Chrome (pdfium plugin), it works fine. However, in Acrobat (Reader version 2017.012.20098) it behaves as follows:

I open the PDF. It displays a response box. I select (by mouse) the text in the editable field. I press Cntrl-C. I open MsWord, and press Cntrl-V. Works fine. I then close the response box (either by "OK" or "Cancel"), return to the same MsWord windows, press Cntrl-V again and nothing happens.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 26, 2017 0
Adobe Community Professional ,
Sep 27, 2017

Copy link to clipboard

Copied

It works fine for me with the latest Acrobat Reader.

(I don't need to select the text in the reponse box, it comes already selected)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 27, 2017 0
Most Valuable Participant ,
Sep 27, 2017

Copy link to clipboard

Copied

Same here. Works just fine.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 27, 2017 0
Community Beginner ,
Oct 01, 2017

Copy link to clipboard

Copied

I asked a friend to try it on her computer, and it doesn't work. Maybe it's something in the system configuration? what can it be?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 01, 2017 0
Most Valuable Participant ,
Oct 02, 2017

Copy link to clipboard

Copied

What's your OS version?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 02, 2017 0
Community Beginner ,
Oct 03, 2017

Copy link to clipboard

Copied

Windows 10 Pro

1703

The native language here is Hebrew, in case it matters.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 03, 2017 0
Most Valuable Participant ,
Oct 03, 2017

Copy link to clipboard

Copied

Is the text you're displaying in the box also in Hebrew?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 03, 2017 0
Community Beginner ,
Oct 03, 2017

Copy link to clipboard

Copied

No. As I said, it's an email address.

In the example I sent you (linked, actually), the text is purely English.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 03, 2017 0
Community Beginner ,
Oct 04, 2017

Copy link to clipboard

Copied

Another approach I can think of is, give up the alert & response boxes. I can write the information I want in a textfield in the documents itself, make it hidden, and when the user finishes, I can make that field visible.

However, if this field is read-only, then its value is unselectable. And I prefer not to make it editable. Any ideas?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 04, 2017 0
Most Valuable Participant ,
Oct 04, 2017

Copy link to clipboard

Copied

Make the field editable and as its custom validation script enter this code:

event.rc = false;

On Wed, Oct 4, 2017 at 2:41 PM, akyd8807993 <forums_noreply@adobe.com>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 04, 2017 1
Community Beginner ,
Oct 14, 2017

Copy link to clipboard

Copied

Good idea. Thank you!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 14, 2017 0