Collapse all comments via code

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

reinierkops
User
Posts: 93
Joined: Mon Jul 07, 2008 8:41 am

Collapse all comments via code

Post by reinierkops »

How can I collapse all comments via code?
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Collapse all comments via code

Post by Corwin - Tracker Sup »

You can use next JavaScript code:

Code: Select all

var annots=this.getAnnots(0);
if(annots!=null)
{
   for(var i=0;i<annots.length;i++)
   {
      var annot=annots[i];
		if (annot!=null)
		{
			annot.popupOpen = false;
		}
   }
}
reinierkops
User
Posts: 93
Joined: Mon Jul 07, 2008 8:41 am

Re: Collapse all comments via code

Post by reinierkops »

I meant to collapse the annotations in the commentsview of PDFXChange Viewer, there is allready a button for it.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Collapse all comments via code

Post by Corwin - Tracker Sup »

You can run next commands:
33241 to Collapse all comments in Comments panel
and
33242 to Expand all comments in Comments panel

Code: Select all

CoPDFXCview1.DoVerb('', 'ExecuteCommand', 33241, vDataOut, 0); // Collapse
CoPDFXCview1.DoVerb('', 'ExecuteCommand', 33242, vDataOut, 0); // Expand
___

And if you want to close or open all Popups on the PDF document you can use "CloseAllPopups" (36439) or "OpenAllPopups" (36438) commands.
reinierkops
User
Posts: 93
Joined: Mon Jul 07, 2008 8:41 am

Re: Collapse all comments via code

Post by reinierkops »

When I execute this command, I receive "Command is currently disabled"
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Collapse all comments via code

Post by Corwin - Tracker Sup »

33241 and 33242 commands won’t work if Comments pane is closed or if there are no comments.
reinierkops
User
Posts: 93
Joined: Mon Jul 07, 2008 8:41 am

Re: Collapse all comments via code

Post by reinierkops »

How can I realize that all the comments are expand by default? Now I need to click each time on the "+" button.

I tried everytime when I load a document to execute the 33242 command, but then i receive that the command is currently disabled.

Hopefully you can help me.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Collapse all comments via code

Post by Corwin - Tracker Sup »

Sorry, but there is no way you can do such thing.

The Commenting pane is mostly part of the End User functionality and it cannot be controlled in AX at this time.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Collapse all comments via code

Post by DSSavant »

Please note that these commands are not in your SDK documentation.

Having said that, can I get a list of all "hidden" or "undocumented" commands please?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Collapse all comments via code

Post by Vasyl - PDF-XChange »

Hi, DSSavant

You may enumerate all supported commands and look to 'Title' member of each command object,
see our PDF-XChange Viewer ActiveX SDK, section Reference/Named Items/Objects/Commands.

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.