Acrobat User Community Forums

You are not logged in.     Log in to your AUC account.     Don't have an account? Sign up today

#1 2007-11-16 14:53:36

ifb_techie
Member
Registered: 2007-11-16
Posts: 0

Attach a File as a Comment

I'm trying to execute a menu item in acrobat 8 to "attach a file as a comment" using javascript behind a button.

I figured out the javascript that works is app.execMenuItem("Annots:Tool:FileAttachmentMenuItem") ;

When I test it with the debugger it works fine..however when I save it and test it in preview mode..it doesn't work. Any ideas? If it helps, I'm using a mac running OS X version 10.4.10

Thanks


My Product Information:
Acrobat Pro 8 / Macintosh

Offline

 

#2 2007-11-20 12:52:35

lkassuba
Moderator

Registered: 2007-06-29
Posts: 1266

Re: Attach a File as a Comment

Hi ifb_techie,

The execution of a menu item from a PDF is restricted to a set of "safe" functions in Acrobat 8 for security reasons, which is why you cannot run the javascript. For more information on this visit Thom Parkers blog at:
http://www.acrobatusers.com/blogs/thomp/?p=10

Thanks,
Lori


Forum Moderator and Community Manager for AcrobatUsers.com

Offline

 

#3 2007-11-20 13:51:19

ifb_techie
Member
Registered: 2007-11-16
Posts: 0

Re: Attach a File as a Comment

Hi Lori,

Thanks for you response. I am aware that Acrobat 8 has a set of safe functions for security reasons and have already read Thom Parkers blog you listed.

It is true that the menu function to attach a file has been restricted under the Document Menu item "Attach a File". However, commenting is not restricted and there is an option to attach a file as a comment...which works in an Acrobat Reader enabled form.

So my question basically is..if I can execute an action through the menu items, why can't I execute that same action through the use of a button?

Offline

 

#4 2007-11-29 11:22:52

lkassuba
Moderator

Registered: 2007-06-29
Posts: 1266

Re: Attach a File as a Comment

Hi ifb_techie,

Some the Javascript methods have security restrictions (i.e., Attach a File). Therefore, these methods can only be executed in a priviledged context (console, batch, and application initialization events). Other events, like mouse-up (your button) are considered non-priviledged. After Acrobat 7, menu items are also considered non-priviledged. Therefore to run them (menu items), you'll either need to change your Javascript preferences or execute the method through a trusted function. For more information on trusted function check out the Javascript for API Reference at:
http://www.adobe.com/devnet/acrobat/pdf … erence.pdf

So in summary, you can't execute the your action through the use of a button (even though the same command may be on the menu when you reader-enable a PDF) because it is a security limitation of using javascript in Acrobat.

Lori


Forum Moderator and Community Manager for AcrobatUsers.com

Offline

 

#5 2007-11-30 09:54:39

ifb_techie
Member
Registered: 2007-11-16
Posts: 0

Re: Attach a File as a Comment

Hi Lori,

Thanks for your quick response. However, I have just one more question.

If I understand you correctly, can I therefore create my form using an older version of Acrobat Professional where these privilegesare still available? If so, will there be any incompatibilities with newer versions of Reader?

Offline

 

#6 2007-12-03 09:50:52

lkassuba
Moderator

Registered: 2007-06-29
Posts: 1266

Re: Attach a File as a Comment

Hi ifb_techie,

There will be compatibility issues with newer versions of Acrobat.
One other possibility open to you is to use the suggestion made by Thom Parker in this posting to attached files via a form field:
http://www.acrobatusers.com/forums/ask_ … view/3626/

FYI: In order to see the "Field is used for file selection" Option, you'll need to make sure that the only option you have selected is "Scroll Long Text" in the Options tab.

Hope this helps,
Lori


Forum Moderator and Community Manager for AcrobatUsers.com

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

AcrobatUsers.com  >>  User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in