public class

PDFViewCtrl.Selection

extends Object
implements AutoCloseable
java.lang.Object
   ↳ com.pdftron.pdf.PDFViewCtrl.Selection

Class Overview

A class representing the current text selection.

Summary

Public Methods
void close()
Frees the native memory of the object.
String getAsHtml()
Get the selected text as html.
String getAsUnicode()
Get the selected text as unicode string
int getPageNum()
Get the page number containing the selected text
double[] getQuads()
Returns the list of tight bounding quads in the current text selection.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.AutoCloseable

Public Methods

public void close ()

Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

public String getAsHtml ()

Get the selected text as html.

Note: this function can be used to implement clipboard copy and paste that preserves text formatting.

Returns
  • the current text selection in HTML format. HTML text will contain styling information such as text color, font size, style etc.

public String getAsUnicode ()

Get the selected text as unicode string

Returns
  • the current text selection represented as an Unicode string.

public int getPageNum ()

Get the page number containing the selected text

Returns
  • the page number containing the selected text.

public double[] getQuads ()

Returns the list of tight bounding quads in the current text selection.

Returns
  • the list of bounding boxes