Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cliendata object

Explorer ,
Jun 01, 2016 Jun 01, 2016

I mentioned that my clientdata object is shared with other open pdf documents. That is not what I want. I need one clientdata object for one document. And another clientdata object for another document.

I need tot store specific document things in the object, which are different for another document. These values may not be overwritten.

How can I do so ?

TOPICS
Acrobat SDK and JavaScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 02, 2016 Jun 02, 2016

Take a look at this page from the SDK documentation:

Acrobat DC SDK Documentation - About the Acrobat Core API

It explains the different layers of the plug-in API. As you can see, all "AV" type functions and types are related to the viewer. All "PD" type function and types are related to PDF documents. The difference between an AVDoc and a PDDoc is that they both reference the same document, but one is used for controlling the viewer specific behavior of a document, and the other the actual docu

...
Translate
Community Expert ,
Jun 01, 2016 Jun 01, 2016

This seems to be referring to an earlier question. Without you providing a link to that question, we unfortunately don't know what this "client data" is referring to. We don't know which API you are using, or what you've already tried. Please provide either a link to your previous question, or provide all the information we need here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2016 Jun 01, 2016

The clientdata object is an object I make when the plugin is loaded, this object I pass through the callback functions. However, it seems that a plugin is loaded once, even if I open 4 documents. The settings I do in the clientdata object are 'shared' with all open documents, and that is something I do NOT want.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2016 Jun 01, 2016

That is correct, a plug-in is only loaded once, when Acrobat starts and unloaded when Acrobat is getting closed (that is a simplification, but as far as the one instance of a plug-in is concerned, it's correct). You need to get more familiar with what a plug-in is and how it works in order to write a plug-in. If you want to keep track of open documents and data associated with them, you need to manage that data yourself. You can subscribe to the "did open" and "did close" events to keep that list current, and then just store your data in an appropriate data structure.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 01, 2016 Jun 01, 2016

You can also look at storing the data temporarily in the document itself if need be.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2016 Jun 01, 2016

The only thing I need to do is the following.

1 When a document is opened, I read a string from a file.

2 When the current page changes, I need to do something with this string.

When I open a new document (without closing the previous document), it reads a new string and does something with this new string, that is fine.

But if I then go back to the previous document, the 'new' string is used on that document, that is something I do not want.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2016 Jun 01, 2016

You must adapt your code because there is only one copy of Acrobat for all open documents, so only one copy of the plugin.

Keep a list of strings and a list of PDDoc objects. That's simple, but register for notifications so you know when a PDDoc closes and you can remove it from the list.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2016 Jun 01, 2016

I think I can use that.


Is a PDDoc variable a normal pointer ?

Sorry for my questions, but what is the difference between an AvDoc and a PDDoc.

Do I need the PDDocDidClose or the AvDocDidClose notification ?

I am not sure what the difference is. They are both 'docs'...

I also read in the documentation the following:

"Starting with Acrobat 7.0, it is possible to have multiple windows open on the same document."

Does this mean when I open a document twice, I have two exactly the same AVDoc values ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2016 Jun 02, 2016

Take a look at this page from the SDK documentation:

Acrobat DC SDK Documentation - About the Acrobat Core API

It explains the different layers of the plug-in API. As you can see, all "AV" type functions and types are related to the viewer. All "PD" type function and types are related to PDF documents. The difference between an AVDoc and a PDDoc is that they both reference the same document, but one is used for controlling the viewer specific behavior of a document, and the other the actual document. Every document that is open in Acrobat (or Reader) is represented by a PDDoc, but only those that are also shown in the viewer have an AVDoc as well. You can open PDF documents without showing them, and in such a case you would only have a PDDoc, and no AVDoc. You will never have just an AVDoc. You can go back and forth between PDDoc and AVDoc by requesting the corresponding "other" document type.

You do not need to know what a PDDoc type actually is - it's an opaque type, and you just use it without knowing what it is. This way, Adobe can change it's implementation without you having to change your code.

If you want to only deal with documents that are open in the viewer you would use the AVDoc type functions, if you are interested in all PDF documents that get opened, use the PDDoc level functions. But, don't be surprised that Acrobat will potentially open a lot of these without you ever seeing anything on the user interface.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 02, 2016 Jun 02, 2016

Can you give me an example when there is a PDDoc open and it is not visible in the viewer ?

Do you for example mean if I minimize the reader ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2016 Jun 03, 2016

Acrobat or another plugin might open a PDF automatically for some purpose. If only a PDDoc is used it will not be visible. You must be prepared to ignore PDDocs not relevant to you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 03, 2016 Jun 03, 2016
LATEST

Okay thank you. I need to highlight a word, so I need an AvDoc, because it must be viewable in the viewer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines