Copy link to clipboard
Copied
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);
}
}
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now