com.qoppa.pdfViewer
Interface IPDFPageView


public interface IPDFPageView

This interface provides access to page views on a PDF document. The interface provides methods for working with the text selection on the pages. To get an object that implements the interface, the host application can call PDFViewerBean.getPageView (int pageNumber). The method returns an object of type JComponent that is guaranteed to implement IPDFPageView.

Author:
Qoppa Software

Field Summary
static Color m_SelectFgndColor
          Deprecated. This variable cannot be changed since it is defined in an interface. Use
static Color m_SelectXORColor
          Deprecated. This variable cannot be changed since it is defined in an interface. Use
 
Method Summary
 TextSelection clearTextSelection()
          Clears the current text selection.
 TextSelection getTextSelection()
          Returns the current text selection in the page, if any.
 boolean isInvertColorsMode()
          Returns whether or not the page view is set to invert color mode.
 TextSelection selectTextInArea(Rectangle2D selectRect)
          Selects the text in an area of the page.
 TextSelection selectTextWithCursors(Point2D startCursor, Point2D endCursor)
          Selects the text in the page from the start cursor to the end cursor, in reading mode.
 void setInvertColorsMode(boolean invertMode)
          Sets the page to paint in inverted mode: Black will show as white and white as black.
 void setTextSelection(TextSelection ts)
          Sets the text selection in this page.
 

Field Detail

m_SelectXORColor

static final Color m_SelectXORColor
Deprecated. This variable cannot be changed since it is defined in an interface. Use
This color is used when selecting text by making a call to Graphics2D.setXORMode (m_SelectXORColor).


m_SelectFgndColor

static final Color m_SelectFgndColor
Deprecated. This variable cannot be changed since it is defined in an interface. Use
This color is used when selecting text by making a call to Graphics2D.setColor (m_SelectFgndColor) immediately after making a call to Graphics2D.setXORMode (m_SelectXORColor).

Method Detail

setTextSelection

void setTextSelection(TextSelection ts)
Sets the text selection in this page.

Parameters:
ts - The new text selection.

clearTextSelection

TextSelection clearTextSelection()
Clears the current text selection. This method has no effect if there is no text selected on the page.

Returns:
The current text selection, before being cleared.

getTextSelection

TextSelection getTextSelection()
Returns the current text selection in the page, if any. If there is no text selected, the method returns null.

Returns:
The current text selection on the page.

setInvertColorsMode

void setInvertColorsMode(boolean invertMode)
Sets the page to paint in inverted mode: Black will show as white and white as black. Colors will be inverted as well by XOR'ing them with all white.

Parameters:
invertMode - The new invert mode.

isInvertColorsMode

boolean isInvertColorsMode()
Returns whether or not the page view is set to invert color mode.

Returns:
true if the page view is painted with invert color mode, false otherwise.

selectTextWithCursors

TextSelection selectTextWithCursors(Point2D startCursor,
                                    Point2D endCursor)
                                    throws PDFException
Selects the text in the page from the start cursor to the end cursor, in reading mode. Reading mode implies line wrapping, column detection and wrapping and more. The effect should be the same as if the user chose the text selection tool, pressed down at the startCursor location and dragged to the endCursor location.

Parameters:
startCursor - the location where the cursor should start selection
endCursor - The location where the cursor ends selection
Returns:
A TextSelection object representing the text that was selected.
Throws:
PDFException

selectTextInArea

TextSelection selectTextInArea(Rectangle2D selectRect)
                               throws PDFException
Selects the text in an area of the page. The coordinates on the page should be in 'display' coords, i.e. the origin of the coordinates is page.getCropBox.getX() and page.getCropBox().getY().

Parameters:
selectRect - The rectangle in which to select the text.
Returns:
A TextSelection object representing the selected text. null if no text is selected. The text selection coordinates will be returned in 'display' space as well, i.e. the origin of the coordinates is page.getCropBox.getX() and page.getCropBox().getY();
Throws:
PDFException