Skip to content
Guides

Get the Selected Content

Users can drag the mouse or use their fingers to select text in the PDF document, obtaining the selected content in real time.

This example shows how to Get the selected content:

java
int pageIndex = 0;
CPDFPageView pageView = (CPDFPageView) getChildAt(pageIndex);
if (pageView == null) return;

ISelectionHelper selectionHelper = ((CPDFPageView)pageView).getSelectionHelper();
if (selectionHelper == null) return;

List<CPDFTextSelection> selections = selectionHelper.getSelections();
if (selections == null || selections.size() <= 0) return;