com.crionics.jpdf.viewer
Class RendererPanel

java.lang.Object
  extended by JViewerRenderer
      extended by com.crionics.jpdf.viewer.RendererPanel
All Implemented Interfaces:
IViewer

public final class RendererPanel
extends JViewerRenderer
implements IViewer

A simple PDF Rendering panel which only shows the document in a scroll panel.
The component is aimed at programmers: it doesn't provide any visual elements to rotate, zoom, browse or layout pages.


Field Summary
 
Fields inherited from interface com.crionics.jpdf.viewer.IViewer
PAGELAYOUT_1X1, PAGELAYOUT_2X1, PAGELAYOUT_2X2, PAGEZOOM_FITPAGE, PAGEZOOM_FITWIDTH
 
Constructor Summary
RendererPanel()
          Constructor
 
Method Summary
 boolean closeDocument()
          Closes the current displayed document.
 void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Used internally to process UI events.
 int getPageCount()
           
 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)
          IMPORTANT: the loading is ASYNCHRONOUS, please use the method isDocumentLoaded() to check when to document is completely rendered.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.crionics.jpdf.viewer.IViewer
getPageFormat, setZoomTo, setZoomToArea
 

Constructor Detail

RendererPanel

public RendererPanel()
Constructor

Method Detail

closeDocument

public boolean closeDocument()
Description copied from interface: IViewer
Closes the current displayed document.

Specified by:
closeDocument in interface IViewer
Returns:
the return value can be ignored - it is used internally.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Used internally to process UI events.


getPageCount

public int getPageCount()
                 throws PdfException
Throws:
PdfException

getPageIndex

public int getPageIndex()
                 throws PdfException
Description copied from interface: IViewer
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.

Specified by:
getPageIndex in interface IViewer
Returns:
the current displayed page index [1 to max]
Throws:
PdfException

getPageLayout

public int getPageLayout()
                  throws PdfException
Description copied from interface: IViewer
Returns the current page layout.

Specified by:
getPageLayout in interface IViewer
Returns:
layout 1,2 (2x1) or 4 (2x2)
Throws:
PdfException - pdf related issues

getPageRotation

public int getPageRotation()
Description copied from interface: IViewer
return the page orientation. typically, 0,90,180 or 270

Specified by:
getPageRotation in interface IViewer
Returns:
the page orientation.

getPageZoom

public int getPageZoom()
                throws PdfException
Description copied from interface: IViewer
returns the current zoom factor applied to the page. the integer value is a percentage.

Specified by:
getPageZoom in interface IViewer
Returns:
the current zoom factor
Throws:
PdfException - pdf related issues

getPageZoomMode

public int getPageZoomMode()
                    throws PdfException
Description copied from interface: IViewer
returns the zoom mode, either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH

Specified by:
getPageZoomMode in interface IViewer
Returns:
the zoom mode, either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH
Throws:
PdfException - pdf related issues

getPdfDocument

public PdfDocument getPdfDocument()
Description copied from interface: IViewer
returns the underlying PDF document, or null if none displayed

Specified by:
getPdfDocument in interface IViewer
Returns:
the underlying PDF document, or null if none displayed

isDocumentLoaded

public boolean isDocumentLoaded()
Description copied from interface: IViewer
return true if document is loaded and displayed

Specified by:
isDocumentLoaded in interface IViewer
Returns:
true if document is loaded and displayed

setDocument

public void setDocument(PdfDocument thedoc)
                 throws PdfException
Description copied from interface: IViewer
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.

Specified by:
setDocument in interface IViewer
Throws:
PdfException - issue related to PDF
PdfAuthException - issue with authentication

printCurrentPage

public void printCurrentPage()
                      throws PdfException
Description copied from interface: IViewer
Shows a dialog to print the current page.

Specified by:
printCurrentPage in interface IViewer
Throws:
PdfException

printDocument

public void printDocument()
Description copied from interface: IViewer
Shows a dialog to print the document. Simulates a user click on the print icon.

Specified by:
printDocument in interface IViewer

printPageRange

public void printPageRange(int startIndex,
                           int endIndex)
Description copied from interface: IViewer
Shows a dialog to print a page range.

Specified by:
printPageRange in interface IViewer
Parameters:
startIndex - start page index [1,+]
endIndex - end page index [1,+]

setDocument

public void setDocument(java.io.File pathToPDF)
                 throws java.io.IOException,
                        PdfException,
                        PdfAuthException
Description copied from interface: IViewer
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.

Specified by:
setDocument in interface IViewer
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

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

Specified by:
setDocument in interface IViewer
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

public void setPageIndex(int pageNumber)
Description copied from interface: IViewer
Forces the renderer to display the given page index.

Specified by:
setPageIndex in interface IViewer
Parameters:
pageNumber - the page index to display

setPageLayout

public void setPageLayout(int layout)
                   throws PdfException
Description copied from interface: IViewer
Changes how many pages are displayed per screen. The pages are arranged per matrix of 1, 2x1 or 2x2

Specified by:
setPageLayout in interface IViewer
Parameters:
layout - 1,2 (2x1) or 4 (2x2)
Throws:
PdfException - pdf related issues

setPageRotation

public void setPageRotation(int rotation)
Description copied from interface: IViewer
Sets the page orientation.

Specified by:
setPageRotation in interface IViewer
Parameters:
rotation - the page rotation is degrees, typically 0,90,180 or 270

setPageZoom

public void setPageZoom(int percentage)
Description copied from interface: IViewer
Sets the zoom factor. the value is a percentage. the zoom factor interpretation is heavily dependent on the zoom mode.

Specified by:
setPageZoom in interface IViewer
Parameters:
percentage - an integer value which represents a zoom percentage.

setPageZoomMode

public void setPageZoomMode(int mode)
                     throws PdfException
Description copied from interface: IViewer
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.

Specified by:
setPageZoomMode in interface IViewer
Parameters:
mode - either PAGEZOOM_FITPAGE or PAGEZOOM_FITWIDTH
Throws:
PdfException - pdf related issues


Copyright © 1999-2007 Crionics. All Rights Reserved.