com.crionics.jpdf.viewer
Interface IViewer

All Known Implementing Classes:
RendererPanel, ViewerPanel

public interface IViewer

Common interface used for the viewer components.


Field Summary
static int PAGELAYOUT_1X1
           
static int PAGELAYOUT_2X1
           
static int PAGELAYOUT_2X2
           
static int PAGEZOOM_FITPAGE
           
static int PAGEZOOM_FITWIDTH
           
 
Method Summary
 boolean closeDocument()
          Closes the current displayed document.
 java.awt.print.PageFormat getPageFormat(int pageIndex)
          Returns the page format in page space.
 int getPageIndex()
          Returns the current displayed page index.
 int getPageLayout()
          Returns the current page layout.
 int getPageRotation()
          return the page orientation. typically, 0,90,180 or 270
 int getPageZoom()
          returns the current zoom factor applied to the page. the integer value is a percentage.
 int getPageZoomMode()
          returns the zoom mode, either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH
 PdfDocument getPdfDocument()
          returns the underlying PDF document, or null if none displayed
 boolean isDocumentLoaded()
          return true if document is loaded and displayed
 void printCurrentPage()
          Shows a dialog to print the current page.
 void printDocument()
          Shows a dialog to print the document.
 void printPageRange(int startIndex, int endIndex)
          Shows a dialog to print a page range.
 void setDocument(java.io.File pathToPDF)
          Loads and Displays the given document in the rendering panel.
 void setDocument(java.io.File pathToPDF, ICredentials credentials)
          Displays the given document in the rendering panel using the given credentials.
 void setDocument(PdfDocument thedoc)
          Loads and Displays the given document in the rendering panel.
 void setPageIndex(int pageNumber)
          Forces the renderer to display the given page index.
 void setPageLayout(int layout)
          Changes how many pages are displayed per screen.
 void setPageRotation(int rotation)
          Sets the page orientation.
 void setPageZoom(int percentage)
          Sets the zoom factor. the value is a percentage. the zoom factor interpretation is heavily dependent on the zoom mode.
 void setPageZoomMode(int mode)
          Sets the zoom mode, either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH.
 void setZoomTo(int pageIndex, java.awt.geom.Point2D location, int zoomFactor)
          Centers the viewer scroll panel to the given page index, point location and zoom factor.
 void setZoomToArea(int pageIndex, java.awt.geom.Point2D upperLeft, java.awt.geom.Point2D bottomRight)
           
 

Field Detail

PAGELAYOUT_1X1

static final int PAGELAYOUT_1X1
See Also:
Constant Field Values

PAGELAYOUT_2X1

static final int PAGELAYOUT_2X1
See Also:
Constant Field Values

PAGELAYOUT_2X2

static final int PAGELAYOUT_2X2
See Also:
Constant Field Values

PAGEZOOM_FITPAGE

static final int PAGEZOOM_FITPAGE
See Also:
Constant Field Values

PAGEZOOM_FITWIDTH

static final int PAGEZOOM_FITWIDTH
See Also:
Constant Field Values
Method Detail

closeDocument

boolean closeDocument()
Closes the current displayed document.

Returns:
the return value can be ignored - it is used internally.

getPageFormat

java.awt.print.PageFormat getPageFormat(int pageIndex)
                                        throws PdfException,
                                               java.io.IOException
Returns the page format in page space.

Parameters:
pageIndex - the page index [1 to max]
Returns:
the page format in page space
Throws:
java.io.IOException - Raised if a problem occurred while reading the file.
PdfException - Raised if a problem occurred while parsing the file.

getPageIndex

int getPageIndex()
                 throws PdfException
Returns the current displayed page index. Note that if the matrix layout displays more then one page, the return value represents the page that is the closer to the center.

Returns:
the current displayed page index [1 to max]
Throws:
PdfException

getPageLayout

int getPageLayout()
                  throws PdfException
Returns the current page layout.

Returns:
layout 1,2 (2x1) or 4 (2x2)
Throws:
PdfException - pdf related issues

getPageRotation

int getPageRotation()
return the page orientation. typically, 0,90,180 or 270

Returns:
the page orientation.

getPageZoom

int getPageZoom()
                throws PdfException
returns the current zoom factor applied to the page. the integer value is a percentage.

Returns:
the current zoom factor
Throws:
PdfException - pdf related issues

getPageZoomMode

int getPageZoomMode()
                    throws PdfException
returns the zoom mode, either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH

Returns:
the zoom mode, either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH
Throws:
PdfException - pdf related issues

getPdfDocument

PdfDocument getPdfDocument()
returns the underlying PDF document, or null if none displayed

Returns:
the underlying PDF document, or null if none displayed

isDocumentLoaded

boolean isDocumentLoaded()
return true if document is loaded and displayed

Returns:
true if document is loaded and displayed

printCurrentPage

void printCurrentPage()
                      throws PdfException
Shows a dialog to print the current page.

Throws:
PdfException

printDocument

void printDocument()
Shows a dialog to print the document. Simulates a user click on the print icon.


printPageRange

void printPageRange(int startIndex,
                    int endIndex)
Shows a dialog to print a page range.

Parameters:
startIndex - start page index [1,+]
endIndex - end page index [1,+]

setDocument

void setDocument(PdfDocument thedoc)
                 throws PdfException
Loads and Displays the given document in the rendering panel.
IMPORTANT: the loading is ASYNCHRONOUS, please use the method isDocumentLoaded() to check when to document is completely rendered.

Parameters:
pathToPDF - path to the document
Throws:
java.io.IOException - issue related to io and caching
PdfException - issue related to PDF
PdfAuthException - issue with authentication

setDocument

void setDocument(java.io.File pathToPDF)
                 throws java.io.IOException,
                        PdfException,
                        PdfAuthException
Loads and Displays the given document in the rendering panel.
IMPORTANT: the loading is ASYNCHRONOUS, please use the method isDocumentLoaded() to check when to document is completely rendered.

Parameters:
pathToPDF - path to the document
Throws:
java.io.IOException - issue related to io and caching
PdfException - issue related to PDF
PdfAuthException - issue with authentication

setDocument

void setDocument(java.io.File pathToPDF,
                 ICredentials credentials)
                 throws java.io.IOException,
                        PdfException,
                        PdfAuthException
Displays the given document in the rendering panel using the given credentials. Use this method to open document password or certificate protected. IMPORTANT: the loading is ASYNCHRONOUS, please use the method isDocumentLoaded() to check when to document is completely rendered.

Parameters:
pathToPDF - path to the document, if null - the current document is closed.
credentials - password or certificate credentials to open the document
Throws:
java.io.IOException - issue related to io and caching
PdfException - issue related to PDF
PdfAuthException - issue with authentication

setPageIndex

void setPageIndex(int pageNumber)
Forces the renderer to display the given page index.

Parameters:
pageNumber - the page index to display

setPageLayout

void setPageLayout(int layout)
                   throws PdfException
Changes how many pages are displayed per screen. The pages are arranged per matrix of 1, 2x1 or 2x2

Parameters:
layout - 1,2 (2x1) or 4 (2x2)
Throws:
PdfException - pdf related issues

setPageRotation

void setPageRotation(int rotation)
Sets the page orientation.

Parameters:
rotation - the page rotation is degrees, typically 0,90,180 or 270

setPageZoom

void setPageZoom(int percentage)
Sets the zoom factor. the value is a percentage. the zoom factor interpretation is heavily dependent on the zoom mode.

Parameters:
percentage - an integer value which represents a zoom percentage.

setPageZoomMode

void setPageZoomMode(int mode)
                     throws PdfException
Sets the zoom mode, either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH. PAGEZOOM_FITPAGE, will fit the whole page on the screen. PAGEZOOM_FITWIDTH will fit the page width.

Parameters:
mode - either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH
Throws:
PdfException - pdf related issues

setZoomTo

void setZoomTo(int pageIndex,
               java.awt.geom.Point2D location,
               int zoomFactor)
               throws PdfException,
                      java.io.IOException
Centers the viewer scroll panel to the given page index, point location and zoom factor. The location should be expressed in page units. Please refer to the method getPageFormat()

Parameters:
pageIndex - the index of the page to zoom onto [1, max]
location - the location in PageSpace of the point to center on
zoomFactor - zoom factor to , use -1 to set unchanged
Throws:
PdfException
java.io.IOException

setZoomToArea

void setZoomToArea(int pageIndex,
                   java.awt.geom.Point2D upperLeft,
                   java.awt.geom.Point2D bottomRight)
                   throws PdfException,
                          java.io.IOException
Parameters:
pageIndex - the index of the page to zoom onto [1, max]
upperLeft -
bottomRight -
Throws:
PdfException
java.io.IOException


Copyright © 1999-2007 Crionics. All Rights Reserved.