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);
}
}
Copy link to clipboard
Copied
[Moved to the Acrobat SDK forum]
Copy link to clipboard
Copied
I have had many wierd issues trying to capture keystrokes in Acrobat. I believe this is because Acrobat grabs them first and decides what to pass along. Keys with special meaning don't normally get passed on. Being a loaded DLL means you are low man on the messaging totem pole.
To solve this issue, and many other event related issues (such as mouse actions) subclass the document window. This still doesn't pass on everything, but it does get you the control key.
Copy link to clipboard
Copied
The menu type parameter in AVAppRegisterForContextMenuAddition must be "page".
AVAppRegisterForContextMenuAddition(ASAtomFromString("page"),...)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now