Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Getting a PDF mouseclick event to C# Windows App

Getting a PDF mouseclick event to C# Windows App

Scheduled Pinned Locked Moved C#
tutorialcsharpjavascriptadobehelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Engineer Joe
    wrote on last edited by
    #1

    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

    B 1 Reply Last reply
    0
    • E 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

      B Offline
      B Offline
      buachaill cliste
      wrote on last edited by
      #2

      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

      E 1 Reply Last reply
      0
      • B buachaill cliste

        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

        E Offline
        E Offline
        Engineer Joe
        wrote on last edited by
        #3

        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.

        B 1 Reply Last reply
        0
        • E Engineer Joe

          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.

          B Offline
          B Offline
          buachaill cliste
          wrote on last edited by
          #4

          Take a look at this[^] then check if the click is inside the pdf control. Hope this helps :-D

          E 1 Reply Last reply
          0
          • B buachaill cliste

            Take a look at this[^] then check if the click is inside the pdf control. Hope this helps :-D

            E Offline
            E Offline
            Engineer Joe
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups