Skip to main content
Participant
Mar 7, 2018 11:42 AM UTC
Answered

Can I create a custom context menu for PDF Fields using Javascript?

Background : I want to create or add my custom action to context menu shown when you right click on a field in PDF.

Approach : Using Javascript is it possible to add my custom actions to this field context menu?

This topic is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
Mar 7, 2018 4:14 PM UTC

Use the app.popUpMenu() function.

Add a script like this to the MouseUp Event on a field. It triggers off of Ctrl/Cmd-Click

if(event.modifier)

{

   var cRtn = app.popUpMenu(...);

    switch(cRtn)

    {

        ... Process Results ...

     }

}

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
Mar 7, 2018 4:14 PM UTC

Use the app.popUpMenu() function.

Add a script like this to the MouseUp Event on a field. It triggers off of Ctrl/Cmd-Click

if(event.modifier)

{

   var cRtn = app.popUpMenu(...);

    switch(cRtn)

    {

        ... Process Results ...

     }

}

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
Mar 7, 2018 1:17 PM UTC

No, that's not possible. You can do it if the user holds down Ctrl or Shift while clicking the field, though.

Translate