Auto-Fit "annotation box" after changing font size via JavaScript

Community Beginner ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Dear community,

 

I use the below script to auto-adjust the font size of all comments in one PDF. However, if I adjust the font size (i.e. "textSize = no.") to a relatively large no., for instance 24, the "annotation box" does not automatically resize with the increased size. What other attribute do I have to include in the script below, to auto-adjust the box?

this.syncAnnotScan();
var annots = getAnnots();
if (annots!=null) {
	for (var i in annots) {
		var annot = annots[i];
		if (annot.type=="FreeText") {
			var annotContents = annot.richContents;
			for (var j in annotContents) annotContents[j].textSize = 12;
			annot.setProps({richContents: annotContents});
		}
	}
}

 Many thanks in advance.

 

Best,

Nick

TOPICS
Comment review and collaborate PDF , JavaScript

Views

25

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
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 22, 2022 Sep 22, 2022

There's no such option with a script, I'm afraid.

Likes

Translate

Translate
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

There's no such option with a script, I'm afraid.

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
community guidelines
Community Beginner ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

LATEST

That's a pity, thanks anyways try67!

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
community guidelines