Skip to main content
aniketb74878072
Participating Frequently
January 15, 2018
Answered

How to open PDF in existing instance of Acrobat Pro DC through C#

  • January 15, 2018
  • 6 replies
  • 3237 views

Using Acrobat DC SDK in C#, with following code

   

     Type PDFType = Type.GetTypeFromProgID("AcroExch.App");
     CAcroApp AcroAppObj = Activator.CreateInstance(PDFType) as CAcroApp;

     AcroAppObj.Show();

     CAcroAVDoc AvDocObj = AcroAppObj.GetActiveDoc() as CAcroAVDoc;

     CAcroPDDoc PdDocObj = AvDocObj.GetPDDoc() as CAcroPDDoc;

I am able to get an opened document, How can I open PDF document in this existing instance through C#?

This topic has been closed for replies.
Correct answer Karl Heinz Kremer

This is unfortunately the way Acrobat works: You cannot open a new document in a new tab when you use the IAC interface - even when you use the JSObject bridge. The document will always open in it's own window. If you however create a JavaScript function in a folder level script which opens a document, and then call that function from within your IAC based interface, the document will open in a new tab. I struggled with this a few weeks ago and ended up creating a folder level script.

6 replies

Legend
January 16, 2018

This is not an instance, by the way. Calling it one will hopelessly confuse your chance of support, if any...

Legend
January 16, 2018

I haven't tried it and, like you, I would expect that if tabs are activated then this would make a new tab. But it does what it does, there are no special controls or API extensions.

Karl Heinz  Kremer
Community Expert
Karl Heinz KremerCommunity ExpertCorrect answer
Community Expert
January 16, 2018

This is unfortunately the way Acrobat works: You cannot open a new document in a new tab when you use the IAC interface - even when you use the JSObject bridge. The document will always open in it's own window. If you however create a JavaScript function in a folder level script which opens a document, and then call that function from within your IAC based interface, the document will open in a new tab. I struggled with this a few weeks ago and ended up creating a folder level script.

Legend
January 16, 2018

Tabs were added only a couple of years ago, but these APIs are over 15 years old. There‘s no specific tab control. Just double checking: you do see tans in this app, right (old Acrobat 2015 does not have tabs)

aniketb74878072
Participating Frequently
January 16, 2018

Ultimately, you wish to say, I can't open doc in existing instance as new tab, opening document will create new instance only.

So, If I wish to open N pdf documents programatically then N Windows will be created, am I correct?

Anyways thanks for the info.

Legend
January 15, 2018

No, there is only one instance of Acrobat. Do you mean it opens a new tab? A new window? This is normal.

aniketb74878072
Participating Frequently
January 16, 2018

It directly opens a new Window, whereas I am expecting to open only a new tab.

Legend
January 15, 2018

Does AVDoc.Open do something different to this?

aniketb74878072
Participating Frequently
January 15, 2018

It open document in a new instance, using following code

AvDocObj.Open(pathForDocument, "")

Legend
January 15, 2018

This should be in the SDK documentation. Do you have it?

aniketb74878072
Participating Frequently
January 15, 2018

Yes, I refer to, Acrobat DC SDK Documentation for reference, but unable to find any clue over there to open a pdf in running instance of Acrobat Pro DC