getCurrentSelection2
Get the current selection.
getCurrentSelection2([out] int *page, [out] double *x0, [out] double *y0,
[out] double *x1, [out] double *y1,
[out, retval] VARIANT_BOOL *isSelection)
If there is a currently active selection, this function
sets
*page
to its page number, *x0, *y0
to
its upper-left corner, *x1, *y1
to its lower-right
corner, and returns true. If there is no selection, this function
returns false.
The coordinates of the upper-left and lower-right corners are in the
PDF file coordinate space - they are not screen pixel
coordinates. This means that changes in zoom or rotation will not
affect the rectangle described by specific values of the four
coordinates. See the convertPDFToWindowCoords2
for conversion to
window coordinates.
VB:
Private Sub CopyMenu_Click()
Dim page As Long
Dim x0 As Double, y0 As Double, x1 As Double, y1 As Double
If viewer.getCurrentSelection2(page, x0, y0, x1, y1) Then
Clipboard.SetText(viewer.extractTextFromPage(page, x0, y0, x1, y1))
End If
End Sub
(This example is for illustration purposes - using copySelection
is much simpler.)