Skip to main content
Participant
March 7, 2018
Answered

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

  • March 7, 2018
  • 2 replies
  • 701 views

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 has been closed for replies.
Correct answer Thom Parker

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 ...

     }

}

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
March 7, 2018

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
try67
Community Expert
Community Expert
March 7, 2018

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