Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Acrobat 6.0 Professoinal, C# Automation, SaveAs

Status
Not open for further replies.

tgreer

Programmer
Oct 4, 2002
1,781
0
0
US
I'm trying to automate Acrobat using C#. I'm using in particular Acrobat 6.0 Professional.

I add the Acrobat object via .NET COM Interop. I can create the App, AVDoc, and PDDoc objects:

Code:
// Create an Acrobat Application object
Type AcrobatAppType;
AcrobatAppType = Type.GetTypeFromProgID("AcroExch.App");
Acrobat.CAcroApp oAdobeApp = (Acrobat.CAcroApp)Activator.CreateInstance(AcrobatAppType);

// Create an Acrobat Document object;
Type AcrobatPDDocType;
AcrobatPDDocType = Type.GetTypeFromProgID("AcroExch.PDDoc");
Acrobat.CAcroPDDoc oAdobePDDoc = (Acrobat.CAcroPDDoc)Activator.CreateInstance(AcrobatPDDocType);

// Create an Acrobat AV Document object;
Type AcrobatAvType;
AcrobatAvType = Type.GetTypeFromProgID("AcroExch.AVDoc");
Acrobat.CAcroAVDoc oAdobeAVDoc = (Acrobat.CAcroAVDoc)Activator.CreateInstance(AcrobatAvType);

Now, I want to open a document, and save it as text. Should be simple enough, however, two problems: opening a document with the PDDoc's "Open" method always fails. Second, there is no "SaveAs()" method!

Futher digging reveals that the JavaScript engine does have a SaveAs method. Ok, I'll use that. Hmm, how to get the JSObject? Oh look, PDDoc has a handy "GetJSObject()" method. However, it returns just a generic "Object", so I can't box it or cast it to anything useful in C#.

Does anyone have any idea how to perform a SaveAs with Acrobat IAC in C#?

Or, does Acrobat 7.0 do this? Can anyone PROVE it with a working example, before I shell out for 7.0? Documentation alone won't do it; I'm afraid I have very little faith in Adobe's APIs.

Thomas D. Greer
 
Thomas,
That all flew quite a long way over my head - however, I did come across this which may be of interest to you. I can quite honestly say that I never expected to reply to a question you had asked ;-)

"If toast always lands butter-side down, and cats always land on their feet, what happens if you strap toast on the back of a cat and drop it?"
- Steven Wright
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top