clicking a pdf button using c sharp
-
First, sorry the subject title looks like an article name. ;P I have a pdf document and has a button embedded using javascript. Is there a possible way i can develop a C Sharp application to click the button? Not me to click it :-)
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
First, sorry the subject title looks like an article name. ;P I have a pdf document and has a button embedded using javascript. Is there a possible way i can develop a C Sharp application to click the button? Not me to click it :-)
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
I would have a look around at C# PDF libraries like PDFSharp[^] and iTextSharp[^]. There are ones out there that will allow you to print PDF documents. Furthermore, I think trying to click the JavaScript-embedded button from C# is the wrong way to look at this - why would you try and run JavaScript inside a PDF that is open in memory in a C# application, especially when the JavaScript is probably dependent on Adobe Acrobat's particular implementation of JavaScript and its API? Why not just print it with your C# code? Do you get what I mean? I thought I would just add that to explain why I didn't tell you how to click the button. I'm not trying to shoot you down, just shed some light on my thought process :) EDIT: Brainwave! You probably don't even need a PDF library if all you're trying to do is print a PDF. Take a loot at the Adobe Reader's command line reference. Have a look at this post on Stack Overflow[^]. It shows two ways of printing with Adobe from the command line. In C# you can achieve this by using System.Diagnostics.Process[^] class. This link shows you examples of starting a process.