Copy link to clipboard
Copied
A week ago I knew nothing about pdf file internal formats or how to write an adobe plugin, but now I have successfully created a plug in to convert the bookmarks to named destinations and then export these named destinations to a text file. I have one bug to fix, though, the situation where the destination name tree does not exist. I could really use some help to finish this off.
Question 1:
So I use the following to get the name tree:
PDNameTree pdNameTree = PDDocGetNameTree(pdDoc, ASAtomFromString("Dests"));
My first issue is how to test for whether this is null.
if (pdNameTree == NULL)
and
if (PDNameTreeEqual(pdNameTree, NULL))
are not acceptable syntax.
So I'm using
if (!PDNameTreeIsValid(pdNameTree))
instead. Does that seem like an acceptable practice? Is there any other way to test if a Destinations name tree already exists?
Question 2:
After determining that there is no destinations name tree, how do I create one? I see the function PDNameTreeNew in the API, but it only takes a single parameter, the pddoc. How do I then take that newly created PDNameTree and associate it with named destinations ("Dests")?
Thanks in advance for your help! I'm so close, I can taste it!
Copy link to clipboard
Copied
1) ALWAYS use xxxIsValid() APIs when they exist.
2) After doing the PDNameTreeNew(), you will need to use Cos APIs to put it where you want.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now