The JPedal Viewer has several methods to allow you to highlight text on the page. This highlighting can be very useful for features such as searching or marking text.
The highlighting of text is displayed in one of two ways. Either a semi-transparent coloured shaped is layered over the text or the colours of the highlighted area are inverted. You can control the highlight colour or inversion using JPedalSettings.TEXT_HIGHLIGHT_COLOUR and JPedalSettings.INVERT_HIGHLIGHT which are detailed in the JPedalSettings JavaDoc.
The text of a PDF can be highlighted using the methods found in TextLines which can be accessed via PdfDecoderInt.getTextLines().
You will notice from the link above that there are several methods that will interact with highlights and highlight-able areas. However the ones you will most likely require addHighlights and clearHighlights.
This method accepts a page value and an array of arrays which contains a series of 4 value arrays defining areas on the page to highlight. The boolean controls how the coordinates are used. When areaSelect is false the coordinates are treated as a start point and endpoint and will attempt to highlight the text in the same manner as a mouse drag. When areaSelect is true it will treat the coordinates as areas to highlight without modification.
TextLines.clearHighlights() This method does exactly what the method name says. It will clear all the highlights that have been added.
Please note: PDF co-ordinates, which treat the bottom left of the page at origin (0,0) are used and not Java co-ordinates (where the origin is top left). You can easily see PDF co-ordinates displayed in the Java PDF viewer.