Copy link to clipboard
Copied
I would like to group multiple comments together using JavaScript. I can do it manually - select objects, right-click, group - but cannot find any data on how to do it using JavaScript. I would be appreciative if anyone could point me in the right direction on this.
I am aware of the current issue with grouped objects not staying together when being moved, but I still need to use the functionality.
Thanks!
Nick
Copy link to clipboard
Copied
The JavaScript API doesn't support grouping. What exactly are you trying to accomplish, there might be a different way to approach the problem.
Copy link to clipboard
Copied
Hey Joel, would something like this work:
var annots = this.getAnnots({nPage:0,}); // if working on page 1 (0-based index)
annots.page = 2; //move all annotations to page 3
or
annots.pageNum++; // to move to the next page
If you want to get a specific group of annotations you will need to specify by author, type , or creation date.
The example above just grabs all annotations found in the specified page.
Copy link to clipboard
Copied
Your code is off but you're on the right track. If the goal is to move a set of selected annotations to a different page, you'd use this.selectedAnnots to get the annotation array of selected annotations but then you'd need to loop through each one and set the page parameter. You can't just set it from the array.
Copy link to clipboard
Copied
Assuming this is static contents, it's not possible. If it's not, please specify what kind of "objects" you're referring to.
Copy link to clipboard
Copied
Are the sticky notes considered static content?
I'm noticing that you're not even able to cut, copy , or paste them even using the GUI method; just select and drag them around in the same page.
Copy link to clipboard
Copied
No, sticky notes are comments (annotations). You should be able to cut, copy and paste them. Maybe they're locked, or you're selecting the text popup instead of the comment itself...
You can't drag them across pages, though. For that you have to cut and paste them.
Copy link to clipboard
Copied
I just realized that I was trying to find the cut, copy, paste options using the "Comment" tool (which is wrong). Comment tool allows me to select all comments(annotations) from the navigation pane provided in the comments tool and then group all selected comments.
Switching to the "Prepare Form" tool provides the "Edit" option in the context menu, with provides another submenu to access the cut, copy, paste options.
I think I need more coffee.
Copy link to clipboard
Copied
You can edit comments in this way in the normal viewing mode. You don't need to go to Prepare Form mode.
Copy link to clipboard
Copied
Three distinct kinds of editable content:
1. Page content. Use Edit PDF, limited editor tool.
2. Form fields. Use Prepare Form tool.
3. Comments/annotations. Limited editing in normal mode, more options if you use Comment tool.
You cannot tell which kind of content you have in the general case. A piece of text could be any of these.
Some other content, e.g. signature appearances, is non editable.