Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can I add an option in Context menu in Adobe Acrobat page? Or how to handle events for ctrl +c/v

Explorer ,
May 28, 2025 May 28, 2025

I am working on a plugin which runs on Adobe Acrobat.
1. I need to copy a custom annotation ( Has image ) and should be able to paste in any page or any other opened pdf document page.  If I do ctrl +c and ctrl +v nothing happens. Checked the flags too it returns 4 which states "PrintAnnot" so the annot is not locked. Not sure if any thing more needs to be added in that annot. Because PDAnnotCanCopy returns false.

 

As of now, Manually creating the annotation by copying its appearance and rectangle. 


I have my code ready but how can I catch (Control + c and Control + v) events?


Code: 

AVAppRegisterForPageViewKeyDown(MyKeyDownHandler,NULL);
....
....


ASBool TTCPlugIn::MyKeyDownHandler(AVPageView pageView, AVKeyCode key, AVFlagBits16 modifiers, void* data)
{

if ((modifiers & AV_CONTROL) && ((key == 'C')||(key=='c')) )
{
// Handle Ctrl+C
AVAlertNote("Ctrl+C was pressed!");
return true; // Event handled
}
return false; 
}

This code works fine if I press C or c or any other alphabet. Doesnt gets triggered if I do a ctrl +c . 

Modifiers are 0 every time . 

 

 

2. Is it possible that I can add an option in context menu? 

AVAppRegisterForContextMenuAddition(ASAtomFromString("MY_MENU"), MyContextMenuAdditionProc, NULL);

 

 

void adddMe(void* S)
{
}

ACCB1 void ACCB2 MyContextMenuAdditionProc(ASAtom menuName, AVMenu menu, void* menuData, void* clientData) {
    // Check if it's the page view context menu
    if (ASAtomGetString(menuName) && strcmp(ASAtomGetString(menuName), "AVPageViewContextMenu") == 0) {
        AVMenuItem menuItem = AVMenuItemNew("My Custom Context Action",
            "NID_MY_CONTEXT_ACTION",
            NULL,
            false,
            0,
            0,
            NULL,
            gExtensionID);

        AVMenuItemSetExecuteProc(menuItem,
            ASCallbackCreateProto(AVExecuteProc, adddMe),
            NULL);

        AVMenuAddMenuItem(menu, menuItem, APPEND_MENUITEM);
    }
}

 

TOPICS
Edit and convert PDFs , General troubleshooting , How to , Modern Acrobat , Windows
55
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation