Getting a PDF mouseclick event to C# Windows App
-
I've got a C# Windows app with an Adobe PDF Reader Control in one of the forms. I'm using acrobat to place buttons in the PDF that will be viewed. I need some way to make the button click in the PDF to be registered as an event in my C# app. I'm having a hard time figuring out how to do this. Would this be easier with an Adobe Acrobat control instead of Reader??? I understand that it might be necessary to put some Javascript in the PDF that runs when the button is clicked and then reference it through my C# (a document level function???). If anyone can guide me in the right direction, it would help immensely. Any help would be greatly appreciated and please keep in mind that I'm pretty new to C# and know nothing at all about JavaScript. Thanks, Engineer Joe
-
I've got a C# Windows app with an Adobe PDF Reader Control in one of the forms. I'm using acrobat to place buttons in the PDF that will be viewed. I need some way to make the button click in the PDF to be registered as an event in my C# app. I'm having a hard time figuring out how to do this. Would this be easier with an Adobe Acrobat control instead of Reader??? I understand that it might be necessary to put some Javascript in the PDF that runs when the button is clicked and then reference it through my C# (a document level function???). If anyone can guide me in the right direction, it would help immensely. Any help would be greatly appreciated and please keep in mind that I'm pretty new to C# and know nothing at all about JavaScript. Thanks, Engineer Joe
Where did you get the adobe pdf reader control? If you create an click event handler for the control it should register when you click it. Wait now.... that was stupid! :-O
modified on Thursday, April 16, 2009 12:26 PM
-
Where did you get the adobe pdf reader control? If you create an click event handler for the control it should register when you click it. Wait now.... that was stupid! :-O
modified on Thursday, April 16, 2009 12:26 PM
got the control by adding reference under Project ---> Add Reference. Chose something like AcroPDFLib from the COM tab. Then right-clicked the toolbox, choose items, and chose Adobe Reader. In my code, I open the appropriate PDF. So I get the PDF to open with no problem. Now I have to get it to register a button click in the PDF. Problem is that it has to be done at runtime, and i'm also not sure adobe provides a way to reference the event through C#. I'm not that great with event handlers...til now i've just chosen them from the menu options...but that's not possible with a button that isn't present until runtime... I've seen some some code that supposedly runs a javascript function in a PDF when a button is clicked, and i hoping that I could create an event like that somehow. Sidenote: I'm amazed at how very little functionality the Adobe Reader control has. I haven't found a way to actually get the X, Y, and Zoom coordinates of the viewing window... They can be set easily enough, but I haven't found a way to GET them.
-
got the control by adding reference under Project ---> Add Reference. Chose something like AcroPDFLib from the COM tab. Then right-clicked the toolbox, choose items, and chose Adobe Reader. In my code, I open the appropriate PDF. So I get the PDF to open with no problem. Now I have to get it to register a button click in the PDF. Problem is that it has to be done at runtime, and i'm also not sure adobe provides a way to reference the event through C#. I'm not that great with event handlers...til now i've just chosen them from the menu options...but that's not possible with a button that isn't present until runtime... I've seen some some code that supposedly runs a javascript function in a PDF when a button is clicked, and i hoping that I could create an event like that somehow. Sidenote: I'm amazed at how very little functionality the Adobe Reader control has. I haven't found a way to actually get the X, Y, and Zoom coordinates of the viewing window... They can be set easily enough, but I haven't found a way to GET them.
-
While this can tell me everything about the mouseclick, i can't find how it will tell me anything about a button being pressed... There's no way for a mouseevent itself to convey what button was pressed. It seems that the original problem of not being able to identify a button in a PDF is the problem... Maybe I should repost the question in that manner...My subject title is misleading now that i know more about the subject. Thank you for the reference to this tool though. I can see it being useful for me in the future. jpc