Page 1 of 1

Highlight annotation contents

Posted: Tue May 23, 2017 2:53 pm
by davestevens
Hello,

We're having an issue getting the text content of highlight annotations in PDF files. We're using javascript to parse the annotations and their properties. All other properties seem correct, i..e page, color and quads. But the contents and richContents properties are always empty, and we're not sure why. We're hoping you can help. This is the javascript we are using to log the annotation properties to console:

Code: Select all

var annots=this.getAnnots();
if(annots!=null){
	for(var i=0;i<annots.length;i++){
		var ann = annots[i];
		var p = ann.getProps();
			for ( o in p ) 
				console.println( o + " : " + p[o] );
	}
}
If it isn't possible to use the contents or richContents properties, is there another way to get the text of the highlight annotations? We've tried using

Code: Select all

getPageNthWord
with the quads, but it is not appearing to be very accurate.

Thanks,

Re: Highlight annotation contents

Posted: Thu Jun 01, 2017 6:43 am
by Ivan - Tracker Software
It is possible to get richContent from highlight annotation when there is text. But if there are no text you will have an empty array instead.

When you create new highlight annotation, highlighted text is not automatically copied as a content of the annotation.
The Editor has an option "Copy selected text into Highlight, Cross-Out, and Underline comment pop-ups" on Editor's preferences "Commenting" page.

HTH

Re: Highlight annotation contents

Posted: Mon Jun 12, 2017 3:56 pm
by davestevens
Ivan - Tracker Software wrote:It is possible to get richContent from highlight annotation when there is text. But if there are no text you will have an empty array instead.

When you create new highlight annotation, highlighted text is not automatically copied as a content of the annotation.
The Editor has an option "Copy selected text into Highlight, Cross-Out, and Underline comment pop-ups" on Editor's preferences "Commenting" page.

HTH
OK, thanks for the reply.

Re: Highlight annotation contents

Posted: Tue Jun 13, 2017 9:46 am
by Will - Tracker Supp
:D