About Hidding Comment by JavaScript

Nov 26, 2017

Copy link to clipboard

Copied

Hi,

I'm using comment as a on fly help system for my forms, but my question is are there any way to hide my comments (All of them) so i can make a button for the user to hide or show the comments , thanks in advance

Comments are a type of PDF annotation, and all annotation objects have a hidden property. So you can hide and show any annotation, as long as you know it's name.

Here's the JS reference entry for the Annot Object

Acrobat DC SDK Documentation

The annot name is created automatically. It is not accessible from the Acrobat UI. You can only get it with JavaScript. I would suggest using the "this.selectedAnnots" property to reset the names of your help annots, with this process.

1. Select a comment object on the PDF page

2. Run this code in the console window while the comment it selected.

this.selectedAnnots[0].name = "MyHelpName";

Then you can use the name to show the comment.

this.getAnnot("MyHelpName").hidden = false;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

161

Likes

Translate

Translate

Report

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

About Hidding Comment by JavaScript

Nov 26, 2017

Copy link to clipboard

Copied

Hi,

I'm using comment as a on fly help system for my forms, but my question is are there any way to hide my comments (All of them) so i can make a button for the user to hide or show the comments , thanks in advance

Comments are a type of PDF annotation, and all annotation objects have a hidden property. So you can hide and show any annotation, as long as you know it's name.

Here's the JS reference entry for the Annot Object

Acrobat DC SDK Documentation

The annot name is created automatically. It is not accessible from the Acrobat UI. You can only get it with JavaScript. I would suggest using the "this.selectedAnnots" property to reset the names of your help annots, with this process.

1. Select a comment object on the PDF page

2. Run this code in the console window while the comment it selected.

this.selectedAnnots[0].name = "MyHelpName";

Then you can use the name to show the comment.

this.getAnnot("MyHelpName").hidden = false;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

162

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 26, 2017 0
Nov 26, 2017

Copy link to clipboard

Copied

Comments are a type of PDF annotation, and all annotation objects have a hidden property. So you can hide and show any annotation, as long as you know it's name.

Here's the JS reference entry for the Annot Object

Acrobat DC SDK Documentation

The annot name is created automatically. It is not accessible from the Acrobat UI. You can only get it with JavaScript. I would suggest using the "this.selectedAnnots" property to reset the names of your help annots, with this process.

1. Select a comment object on the PDF page

2. Run this code in the console window while the comment it selected.

this.selectedAnnots[0].name = "MyHelpName";

Then you can use the name to show the comment.

this.getAnnot("MyHelpName").hidden = false;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 26, 2017 2
medos20 LATEST
Nov 26, 2017

Copy link to clipboard

Copied

Thank you as much as i can

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 26, 2017 0