Copy link to clipboard
Copied
I'm doing iterating all bookmarks in adobe acrobat. So here i want know level by level means: To get all first levels,To get all second levels amd To get third levels. Please give some advise on that.
I need to get higest level of bookmark value.
Copy link to clipboard
Copied
I don't know how it works in those languages, but with JavaScript you start with the bookmark root object and access its children array. Those are the top-level bookmarks. Then each one of those can have its own children array, which are the second-level bookmarks, etc., etc.
If you want to iterate over all of the bookmarks you will need to use a recursive function, where you can keep track of the level using an integer variable that you pass to it as a parameter with an initial value of zero, and increment it by one each time you go down into a new recursion level.
Copy link to clipboard
Copied
Can you please explain clearly. level by level bookmarks.
I'm getting all levels at a time recursive function. I need level wise.
Copy link to clipboard
Copied
Then you need to code differently. For example, iterate levels twice, the first time breadwise and the second time depthwise.
Copy link to clipboard
Copied
I think need to go through datastructues is it right? To find out the levels.
can i use this way implementation:
vector <int> v[10] ; //Vector for maintaining adjacency list explained above
int level[10]; //To determine the level of each node
bool vis[10]; //Mark the node if visited
void bfs(int s) {
queue <int> q;
q.push(s);
level[ s ] = 0 ; //Setting the level of the source node as 0
vis[ s ] = true;
while(!q.empty())
{
int p = q.front();
q.pop();
for(int i = 0;i < v[ p ].size() ; i++)
{
if(vis[ v[ p ][ i ] ] == false)
{
//Setting the level of each node with an increment in the level of parent node
level[ v[ p ][ i ] ] = level[ p ]+1;
q.push(v[ p ][ i ]);
vis[ v[ p ][ i ] ] = true;
}
}
}
}
Copy link to clipboard
Copied
can you please guide
Copy link to clipboard
Copied
It seems your question isn't really about the API (you understand it correctly) but how to create an algorithm given the API. This is probably not the best forum for you.
Copy link to clipboard
Copied
It is completely through working API's, Adobe acrobat Plugin developement using Vc++
Copy link to clipboard
Copied
It looks as if nobody here has the time to help. This is a complex algorithm, and you need to develop it yourself.
Copy link to clipboard
Copied
can you please explain flow of algorthim.
Actually agend: get the Bookmark Levels need to be display in combobox
Copy link to clipboard
Copied
We've explained how it should work. If you want someone to write this (non-trivial) code for you you'll probably need to hire them to do so.
Copy link to clipboard
Copied
Use a recursive function for this. When a bookmark has childrens call the function also for the childrens.
There is a sample in the Acrobat Javascript Reference.