Skip to main content
Participant
March 23, 2018
Answered

Get Path of PDF Opened in Acrobat DC Pro

  • March 23, 2018
  • 2 replies
  • 1783 views

I just wish to retrieve the path of PDF document opened in Acrobat DC Pro, and save paths to my database in c#,

I able to get active pdf document in c# but unable to retrieve path of the document,

Type PDFType = Type.GetTypeFromProgID("AcroExch.App");

CAcroApp AcroAppObj = Activator.CreateInstance(PDFType) as CAcroApp;

CAcroAVDoc AvDocObj = AcroAppObj.GetActiveDoc() as CAcroAVDoc;

CAcroPDDoc PdDocObj = AvDocObj.GetPDDoc() as CAcroPDDoc;

But not getting path of of that document, is there any other way to achieve this?

Help will be much appreciated

This topic has been closed for replies.
Correct answer Thom Parker

There isn't a function in the OLE API for acquiring a path, but you can get this information with JavaScript.

Use the PDDoc object to acquire the JSO, and then use it to get the path property.

Dim jso as Object

Dim path as String

jso = gPDDoc.GetJSObject

path = jso.path

2 replies

zhiwei123
Participating Frequently
July 13, 2018

I still can't get the path in c#, how can I do it? Thanks

Legend
July 13, 2018

We described how to do it. Your question won’t help, since all we could do is repeat what we already said. So please show your code and tell us what goes wrong.

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
March 23, 2018

There isn't a function in the OLE API for acquiring a path, but you can get this information with JavaScript.

Use the PDDoc object to acquire the JSO, and then use it to get the path property.

Dim jso as Object

Dim path as String

jso = gPDDoc.GetJSObject

path = jso.path

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often