Gnostice PDFOne
Pro. Ed. v5.0.0


com.gnostice.pdfone
Class PdfViewer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.gnostice.pdfone.PdfViewer
All Implemented Interfaces:
Accessible, AdjustmentListener, ComponentListener, EventListener, ImageObserver, MenuContainer, MouseListener, MouseMotionListener, MouseWheelListener, Serializable

public class PdfViewer
extends JPanel
implements MouseListener, ComponentListener, MouseMotionListener, MouseWheelListener, AdjustmentListener, Serializable

This class represents a container for displaying an existing PDF documents. A PdfViewer object can be used to display a document only in reading mode.

See Also:
Article: How To Create a Java PDF Viewer In A Snap, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
static int ANGLE_0
          Constant for displaying a page without any rotation or tilt.
static int ANGLE_180
          Constant for displaying a page rotated on its center by 180 degrees.
static int ANGLE_270
          Constant for displaying a page rotated on its center by 270 degrees.
static int ANGLE_90
          Constant for displaying a page rotated on its center by 90 degrees.
static int DPI_110
          Constant specifying viewer resolution of 110 DPI.
static int DPI_72
          Constant specifying viewer resolution of 72 DPI.
static int DPI_96
          Constant specifying viewer resolution of 96 DPI.
static int LAYOUT_AUTO_FIT_COLUMNS_IN_WINDOW
          Constant for fitting as many pages in each row as is possible with the current page zoom level.
static int LAYOUT_SIDE_BY_SIDE
          Constant for displaying two pages in a single row at a time.
static int LAYOUT_SIDE_BY_SIDE_CONTINUOUS
          Constant for displaying two pages each in contiguously placed rows.
static int LAYOUT_SINGLE_PAGE
          Constant for displaying one page at a time.
static int LAYOUT_SINGLE_PAGE_CONTINUOUS
          Constant for displaying pages in a single colum.
static int LAYOUT_USER_DEFINED
          Constant for displaying the number of columns specified by setPageColumnsCustomCount(int).
static int MOUSE_INTERACTIVITY_MODE_DEFAULT
          Constant for enabling mouse interactivity for the viewer.
static int MOUSE_INTERACTIVITY_MODE_NONE
          Constant for enabling mouse interactivity for the viewer.
static int PAGEVIEW_ACTUAL_SIZE
          Constant for displaying the pages in their original size inside the viewer.
static int PAGEVIEW_CUSTOM
          Constant for resizing the pages in a way not similar to PAGEVIEW_ACTUAL_SIZE, PAGEVIEW_FIT_PAGE, or PAGEVIEW_FIT_WIDTH.
static int PAGEVIEW_FIT_PAGE
          Constant for resizing the pages to tightly fit their entire height and width inside the viewer.
static int PAGEVIEW_FIT_WIDTH
          Constant for resizing the pages to tightly fit their entire width inside the viewer.
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PdfViewer()
          Zero-argument default constructor.
 
Method Summary
 void adjustmentValueChanged(AdjustmentEvent e)
           
 void closeDocument()
          Stops display of the loaded document and frees all resources used for it.
 void componentHidden(ComponentEvent e)
           
 void componentMoved(ComponentEvent e)
           
 void componentResized(ComponentEvent e)
           
 void componentShown(ComponentEvent e)
           
 void dispose()
          Closes any loaded document and releases threads pools created by the viewer.
 void finalize()
           
 void firstPage()
          Changes the current page to the first page in the document.
 Color getBackgroundColor()
          Returns background color of the space between the edges of the viewer and displayed PDF document.
 int getCurrentPage()
          Returns number of the currently displayed page.
 PdfDocument getDocument()
          Returns PdfDocument object set up with this viewer.
 int getDpi()
          Returns viewer resolution.
 int getHorizontalScrollBarPolicy()
          Returns horizontal scrollbar policy value.
 double getMaxZoomVal()
          Returns maximum zoom that the viewer will display a page with.
 double getMinZoomVal()
          Returns minimum zoom that the viewer will display a page with.
 int getMouseInteractivityMode()
          Returns mouse interactivity mode of the viewer.
 int getPageColumnsCustomCount()
          Returns number of pages that the viewer displays in a row.
 int getPageCount()
          Returns total number of pages in the displayed document.
 PdfViewerPageDisplaySettings getPageDisplaySettings()
          Returns current default settings of the viewer.
 int getPageLayout()
          Returns current page layout style of the viewer.
 int getPageView()
          Returns how the height and width of the pages are accommodated inside the viewer.
 double[] getPredefinedZoomValues()
          Returns standard zoom zoom factors supported by the viewer.
 Dimension getPreferredSize()
           
 PdfRenderErrorHandler getRenderErrorHandler()
          Returns user class that handles rendering errors of the viewer.
 int getRotationAngle()
          Returns angle of tilt applied to pages when they are displayed.
 int getScrollMode()
          Returns how viewer performs when scrolls its contents.
 int getVerticalScrollBarPolicy()
          Returns vertical scrollbar policy value.
 PdfViewerChangeHandler getViewerChangeHandler()
          Returns the user class that implements the PdfViewerChangeHandler interface and is set to receive viewer status change events.
 Insets getViewerInsets()
          Returns how the edges of the viewer are padded.
 int getViewHistoryItemsLimit()
           
 double getZoom()
          Returns magnification factor with which pages are displayed.
 boolean hasNextView()
          Returns whether a next view exists in the navigation history for the document.
 boolean hasPreviousView()
          Returns whether a previous view exists in the navigation history for the document.
static boolean isFontProcessorLibraryLoaded()
          Deprecated.  
 boolean isShowCoverPageDuringSideBySide()
          Returns whether the first page of the document is set to be displayed singly.
 boolean isShowGapsBetweenPages()
          Returns whether viewer displays insets (margins or empty spaces) between pages.
 boolean isShowPageBordersWhenNoPageGaps()
          Returns whether the viewer displays visible borders around the pages when it does not place insets around the pages.
 boolean isShowPageNumberLabelOnScrolling()
          Returns whether the viewer displays a floating indicator for the current page number when the user scrolls the document.
 boolean isShowPagePreviewOnScrolling()
          Returns whether the viewer displays a floating page preview of the current page when the user scrolls the document.
 void lastPage()
          Changes the current page to the last page in the document.
 void loadDocument(byte[] byteArray)
          Load a PDF document from specified byte array and display it.
 void loadDocument(byte[] byteArray, String password)
          Load encrypted PDF document from specified byte array, read its content with specified password, and display its contents in the PDF viewer.
 void loadDocument(File inFile)
          Load PDF document specified by a java.io.File object and display its contents in the viewer.
 void loadDocument(FileInputStream fileInputStream)
          Load a PDF document specified by a java.io.FileInputStream object and display its contents.
 void loadDocument(FileInputStream fileInputStream, String password)
          Load a PDF document specified by a java.io.FileInputStream object, decrypt it with specified password and display its contents in the viewer.
 void loadDocument(File inFile, String password)
          Load encrypted PDF document specified by a java.io.File object, decrypt it with specified password, and display its contents in the viewer.
 void loadDocument(PdfDocument d)
          Deprecated. Use setDocument(PdfDocument) instead. Displays a specified PDF document.
 void loadDocument(String inFilePath)
          Loads a PDF document with specfied pathname and display its contents in the viewer.
 void loadDocument(String inFilePath, String password)
          Loads a PDF document with specified pathname and display its contents in the viewer.
static void loadFontProcessorLibrary(String libDirPath)
          Deprecated.  
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void mouseWheelMoved(MouseWheelEvent e)
           
 void nextPage()
          Changes current page to the one right after it in the document.
 void nextView()
          Makes the viewer to display the next view in the navigation history of the current document.
 Dimension preferredSize()
           
 void previousPage()
          Changes current page to the one right ahead of it in the document.
 void previousView()
          Makes the viewer to display the previous view in the navigation history of the current document.
 void refresh()
          Displays the PDF document set up by setDocument(PdfDocument) method.
 void rotateClockwise()
          Rotates current page by 90 degrees in the clockwise direction.
 void rotateCounterClockwise()
          Rotates current page by 90 degrees in the counter-clockwise direction.
 void setBackgroundColor(Color bg)
          Sets specified color for background of the space between the edges of the viewer and displayed PDF document.
 void setCurrentPage(int pageNum)
          Changes currently displayed page to the specified page.
 void setCurrentPage(int pageNum, Point location)
          Makes the viewer position its top-left corner on specified point on specified page.
 void setCurrentPage(int pageNum, Point location, double zoom)
          Makes viewer position its top-left corner on specified point on specified page with specified zoom.
 void setCurrentPage(int pageNum, Rectangle2D rect)
          Makes the viewer display specified area on specified page.
 void setDocument(PdfDocument document)
          Set up the viewer with a specified PdfDocument object.
 void setDpi(int screenDPI)
          Sets specified viewer resolution.
 void setHorizontalScrollBarPolicy(int hsbPolicy)
          Specifies when the horizontal scrollbar appears in the scrollpane.
 void setMouseInteractivityMode(int cursorMode)
          Specify mouse interactivity mode of the viewer.
 void setPageColumnsCustomCount(int pageColumnsCustomCount)
          Sets number of pages that viewer displays in a row.
 void setPageDisplaySettings(PdfViewerPageDisplaySettings pageDisplaySettings)
          Sets default settings for the viewer.
 void setPageLayout(int pageLayout)
          Makes the viewer lay out the pages in specified style.
 void setPageView(int pageView)
          Specifies how the height and width of the pages need to be accommodated inside the viewer.
 void setRenderErrorHandler(PdfRenderErrorHandler pdfRenderErrorHandler)
          Sets specified user class that needs to handle rendering errors of the viewer.
 void setRotationAngle(int rotation)
          Specifies angle of tilt that need to be applied to pages when they are displayed.
 void setScrollMode(int scrollMode)
          Specifies how viewer performs when scrolls its contents.
 void setShowCoverPageDuringSideBySide(boolean showCoverPageDuringSideBySide)
          Sets whether the first page need to be displayed singly when pages are displayed side by side.
 void setShowGapsBetweenPages(boolean showGapsBetweenPages)
          Makes the viewer display insets (margins or empty spaces) between pages.
 void setShowPageBordersWhenNoPageGaps(boolean showPageBordersWhenNoPageGaps)
          Sets whether viewer displays visible borders around the pages when it does not place insets around the pages.
 void setShowPageNumberLabelOnScrolling(boolean showPageNumberLabelOnScrolling)
          Specifies whether the viewer displays a floating indicator for the current page number when the user scrolls the document.
 void setShowPagePreviewOnScrolling(boolean showPagePreviewOnScrolling)
          Sets whether viewer will display a page preview when the user scrolls the document.
 void setVerticalScrollBarPolicy(int vsbPolicy)
          Specifies when the vertical scrollbar appears in the scrollpane.
 void setViewerChangeHandler(PdfViewerChangeHandler pdfViewerChangeHandler)
          Specifies user class that implements one or more PdfViewerChangeHandler events.
 void setViewerInsets(Insets insets)
          Specfies how the edges of the viewer are padded.
 void setViewerScrollPane(JScrollPane jScrollPane)
          Adds this viewer to specified scroll pane.
 void setViewHistoryItemsLimit(int historyItemsLimit)
          Sets specified limit to the navigation history of the viewer.
 void setZoom(double zoomFactor)
          Specifies magnification factor with which pages need to be displayed.
 void showNavigationPanel(boolean showNavigationPanel)
          Sets whether viewer display its navigation panel.
 void zoomIn()
          Makes the viewer increase the current zoom level to the next standard zoom value.
 void zoomOut()
          Makes the viewer increase the current zoom level to the next standard zoom value.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DPI_72

public static final int DPI_72
Constant specifying viewer resolution of 72 DPI.

See Also:
getDpi(), setDpi(int), Constant Field Values

DPI_96

public static final int DPI_96
Constant specifying viewer resolution of 96 DPI.

See Also:
getDpi(), setDpi(int), Constant Field Values

DPI_110

public static final int DPI_110
Constant specifying viewer resolution of 110 DPI.

See Also:
getDpi(), setDpi(int), Constant Field Values

MOUSE_INTERACTIVITY_MODE_NONE

public static final int MOUSE_INTERACTIVITY_MODE_NONE
Constant for enabling mouse interactivity for the viewer.

See Also:
Constant Field Values

MOUSE_INTERACTIVITY_MODE_DEFAULT

public static final int MOUSE_INTERACTIVITY_MODE_DEFAULT
Constant for enabling mouse interactivity for the viewer.

See Also:
Constant Field Values

PAGEVIEW_ACTUAL_SIZE

public static final int PAGEVIEW_ACTUAL_SIZE
Constant for displaying the pages in their original size inside the viewer.

See Also:
Constant Field Values

PAGEVIEW_FIT_PAGE

public static final int PAGEVIEW_FIT_PAGE
Constant for resizing the pages to tightly fit their entire height and width inside the viewer.

See Also:
Constant Field Values

PAGEVIEW_FIT_WIDTH

public static final int PAGEVIEW_FIT_WIDTH
Constant for resizing the pages to tightly fit their entire width inside the viewer.

See Also:
Constant Field Values

PAGEVIEW_CUSTOM

public static final int PAGEVIEW_CUSTOM
Constant for resizing the pages in a way not similar to PAGEVIEW_ACTUAL_SIZE, PAGEVIEW_FIT_PAGE, or PAGEVIEW_FIT_WIDTH.

See Also:
setZoom(double), getZoom(), Constant Field Values

LAYOUT_SINGLE_PAGE

public static final int LAYOUT_SINGLE_PAGE
Constant for displaying one page at a time.

See Also:
Constant Field Values

LAYOUT_SINGLE_PAGE_CONTINUOUS

public static final int LAYOUT_SINGLE_PAGE_CONTINUOUS
Constant for displaying pages in a single colum.

See Also:
Constant Field Values

LAYOUT_SIDE_BY_SIDE

public static final int LAYOUT_SIDE_BY_SIDE
Constant for displaying two pages in a single row at a time.

See Also:
Constant Field Values

LAYOUT_SIDE_BY_SIDE_CONTINUOUS

public static final int LAYOUT_SIDE_BY_SIDE_CONTINUOUS
Constant for displaying two pages each in contiguously placed rows.

See Also:
Constant Field Values

LAYOUT_AUTO_FIT_COLUMNS_IN_WINDOW

public static final int LAYOUT_AUTO_FIT_COLUMNS_IN_WINDOW
Constant for fitting as many pages in each row as is possible with the current page zoom level.

See Also:
Constant Field Values

LAYOUT_USER_DEFINED

public static final int LAYOUT_USER_DEFINED
Constant for displaying the number of columns specified by setPageColumnsCustomCount(int).

See Also:
Constant Field Values

ANGLE_0

public static final int ANGLE_0
Constant for displaying a page without any rotation or tilt.

See Also:
Constant Field Values

ANGLE_90

public static final int ANGLE_90
Constant for displaying a page rotated on its center by 90 degrees.

See Also:
Constant Field Values

ANGLE_180

public static final int ANGLE_180
Constant for displaying a page rotated on its center by 180 degrees.

See Also:
Constant Field Values

ANGLE_270

public static final int ANGLE_270
Constant for displaying a page rotated on its center by 270 degrees.

See Also:
Constant Field Values
Constructor Detail

PdfViewer

public PdfViewer()
Zero-argument default constructor.

Method Detail

componentResized

public void componentResized(ComponentEvent e)
Specified by:
componentResized in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent e)
Specified by:
componentMoved in interface ComponentListener

componentShown

public void componentShown(ComponentEvent e)
Specified by:
componentShown in interface ComponentListener

componentHidden

public void componentHidden(ComponentEvent e)
Specified by:
componentHidden in interface ComponentListener

preferredSize

public Dimension preferredSize()

getPreferredSize

public Dimension getPreferredSize()

setViewerScrollPane

public void setViewerScrollPane(JScrollPane jScrollPane)
Adds this viewer to specified scroll pane.

Parameters:
jScrollPane - scroll pane to which this viewer needs to be added.

adjustmentValueChanged

public void adjustmentValueChanged(AdjustmentEvent e)
Specified by:
adjustmentValueChanged in interface AdjustmentListener

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface MouseWheelListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

setBackgroundColor

public void setBackgroundColor(Color bg)
Sets specified color for background of the space between the edges of the viewer and displayed PDF document.

Parameters:
bg - background color of the space between the edges of the viewer and displayed PDF document
See Also:
getBackgroundColor()

getBackgroundColor

public Color getBackgroundColor()
Returns background color of the space between the edges of the viewer and displayed PDF document.

Returns:
background color of the space between the edges of the viewer and displayed PDF document
See Also:
setBackgroundColor(Color)

setHorizontalScrollBarPolicy

public void setHorizontalScrollBarPolicy(int hsbPolicy)
Specifies when the horizontal scrollbar appears in the scrollpane.

Parameters:
hsbPolicy - ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER

getHorizontalScrollBarPolicy

public int getHorizontalScrollBarPolicy()
Returns horizontal scrollbar policy value.

Returns:
horizontal scrollbar policy value
See Also:
setHorizontalScrollBarPolicy(int)

setVerticalScrollBarPolicy

public void setVerticalScrollBarPolicy(int vsbPolicy)
Specifies when the vertical scrollbar appears in the scrollpane.

Parameters:
vsbPolicy - ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
See Also:
getVerticalScrollBarPolicy(), setHorizontalScrollBarPolicy(int), getHorizontalScrollBarPolicy()

getVerticalScrollBarPolicy

public int getVerticalScrollBarPolicy()
Returns vertical scrollbar policy value.

Returns:
horizontal scrollbar policy value
See Also:
getVerticalScrollBarPolicy(), setHorizontalScrollBarPolicy(int), getHorizontalScrollBarPolicy()

setPageView

public void setPageView(int pageView)
                 throws PdfException
Specifies how the height and width of the pages need to be accommodated inside the viewer.

Parameters:
pageView - constant specifying how the height and width of the pages need to be accommodated inside the viewer
Throws:
PdfException - if an illegal argument is supplied.
See Also:
PAGEVIEW_ACTUAL_SIZE, PAGEVIEW_FIT_PAGE, PAGEVIEW_FIT_WIDTH, PAGEVIEW_CUSTOM, getPageView(), setZoom(double)

getPageView

public int getPageView()
Returns how the height and width of the pages are accommodated inside the viewer.

Returns:
constant describing how the height and width of the pages need to be accommodated inside the viewer.
See Also:
PAGEVIEW_ACTUAL_SIZE, PAGEVIEW_FIT_PAGE, PAGEVIEW_FIT_WIDTH, PAGEVIEW_CUSTOM, setPageView(int), setZoom(double)

rotateClockwise

public void rotateClockwise()
                     throws PdfException
Rotates current page by 90 degrees in the clockwise direction.

Throws:
PdfException - if an illegal argument is supplied.
See Also:
rotateCounterClockwise()

rotateCounterClockwise

public void rotateCounterClockwise()
                            throws PdfException
Rotates current page by 90 degrees in the counter-clockwise direction.

Throws:
PdfException - if an illegal argument is supplied.
See Also:
rotateClockwise()

previousPage

public void previousPage()
                  throws IOException,
                         PdfException
Changes current page to the one right ahead of it in the document.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
See Also:
nextPage(), firstPage(), lastPage(), setCurrentPage(int)

nextPage

public void nextPage()
              throws IOException,
                     PdfException
Changes current page to the one right after it in the document.

Throws:
IOException
PdfException
See Also:
previousPage(), firstPage(), lastPage(), setCurrentPage(int)

firstPage

public void firstPage()
               throws IOException,
                      PdfException
Changes the current page to the first page in the document.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
See Also:
lastPage(), previousPage(), nextPage(), setCurrentPage(int)

lastPage

public void lastPage()
              throws IOException,
                     PdfException
Changes the current page to the last page in the document.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
See Also:
firstPage(), previousPage(), nextPage(), setCurrentPage(int)

setZoom

public void setZoom(double zoomFactor)
             throws PdfException
Specifies magnification factor with which pages need to be displayed.

Parameters:
zoomFactor - magnification factor with which pages need to be displayed
Throws:
PdfException - if an illegal argument is supplied.
See Also:
getZoom()

getZoom

public double getZoom()
Returns magnification factor with which pages are displayed.

Returns:
magnification factor with which pages are displayed
See Also:
setZoom(double)

setRotationAngle

public void setRotationAngle(int rotation)
                      throws PdfException
Specifies angle of tilt that need to be applied to pages when they are displayed.

Parameters:
rotation - angle of the tilt
Throws:
PdfException - if an illegal argument is supplied.
See Also:
ANGLE_0, ANGLE_90, ANGLE_180, ANGLE_270, getRotationAngle()

getRotationAngle

public int getRotationAngle()
Returns angle of tilt applied to pages when they are displayed.

Returns:
angle of the tilt
See Also:
setRotationAngle(int)

setCurrentPage

public void setCurrentPage(int pageNum)
                    throws IOException,
                           PdfException
Changes currently displayed page to the specified page.

Parameters:
pageNum - number of the page that needs to be currently displayed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
See Also:
getCurrentPage()

setCurrentPage

public void setCurrentPage(int pageNum,
                           Point location)
                    throws IOException,
                           PdfException
Makes the viewer position its top-left corner on specified point on specified page.

Parameters:
pageNum - number of the page
location - location where the top-left corner of the viewer needs to be positioned
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

setCurrentPage

public void setCurrentPage(int pageNum,
                           Point location,
                           double zoom)
                    throws IOException,
                           PdfException
Makes viewer position its top-left corner on specified point on specified page with specified zoom.

Parameters:
pageNum - number of the page
location - location where the top-left corner of the viewer needs to be positioned
zoom - magnification of the page
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

setCurrentPage

public void setCurrentPage(int pageNum,
                           Rectangle2D rect)
                    throws IOException,
                           PdfException
Makes the viewer display specified area on specified page.

Parameters:
pageNum - number of the page
rect - area that needs to be displayed on the page
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

getCurrentPage

public int getCurrentPage()
Returns number of the currently displayed page.

Returns:
number of the currently displayed page
See Also:
setCurrentPage(int)

getPageCount

public int getPageCount()
Returns total number of pages in the displayed document.

Returns:
total number of pages in the displayed document

setViewerInsets

public void setViewerInsets(Insets insets)
                     throws PdfException
Specfies how the edges of the viewer are padded.

Parameters:
insets - how the edges of the viewer are padded
Throws:
PdfException
See Also:
getViewerInsets(), Insets

getViewerInsets

public Insets getViewerInsets()
Returns how the edges of the viewer are padded.

Returns:
how the edges of the viewer are padded
See Also:
setViewerInsets(Insets), Insets

setScrollMode

public void setScrollMode(int scrollMode)
Specifies how viewer performs when scrolls its contents.

Parameters:
scrollMode - one of the following constants specifying how the viewer scrolls its contents
See Also:
getScrollMode()

getScrollMode

public int getScrollMode()
Returns how viewer performs when scrolls its contents.

Returns:
one of the following constant specifying how the viewer scrolls its contents
See Also:
getScrollMode()

loadDocument

public void loadDocument(PdfDocument d)
                  throws IOException,
                         PdfException
Deprecated. Use setDocument(PdfDocument) instead. Displays a specified PDF document.

Parameters:
d - PDF document that needs to be displayed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
See Also:
setCurrentPage(int)

loadDocument

public void loadDocument(String inFilePath)
                  throws IOException,
                         PdfException
Loads a PDF document with specfied pathname and display its contents in the viewer.

Parameters:
inFilePath - pathname of the document that needs to be displayed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(String inFilePath,
                         String password)
                  throws IOException,
                         PdfException
Loads a PDF document with specified pathname and display its contents in the viewer.

Parameters:
inFilePath - pathname of the document that needs to be displayed
password - password with which it needs to be displayed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(File inFile)
                  throws IOException,
                         PdfException
Load PDF document specified by a java.io.File object and display its contents in the viewer.

Parameters:
inFile - PDF document that needs to be displayed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(File inFile,
                         String password)
                  throws IOException,
                         PdfException
Load encrypted PDF document specified by a java.io.File object, decrypt it with specified password, and display its contents in the viewer.

Parameters:
inFile - PDF document that needs to be displayed
password - password with which the document needs to be decrypted
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(FileInputStream fileInputStream)
                  throws IOException,
                         PdfException
Load a PDF document specified by a java.io.FileInputStream object and display its contents.

Parameters:
fileInputStream - PDF document that needs to be displayed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(FileInputStream fileInputStream,
                         String password)
                  throws IOException,
                         PdfException
Load a PDF document specified by a java.io.FileInputStream object, decrypt it with specified password and display its contents in the viewer.

Parameters:
fileInputStream - PDF document that needs to be displayed
password - password with which the document's contents needs to be decrypted
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(byte[] byteArray)
                  throws IOException,
                         PdfException
Load a PDF document from specified byte array and display it.

Parameters:
byteArray - byte array that contains the PDF document
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(byte[] byteArray,
                         String password)
                  throws IOException,
                         PdfException
Load encrypted PDF document from specified byte array, read its content with specified password, and display its contents in the PDF viewer.

Parameters:
byteArray - byte array that contains the PDF document
password - password with which the document's contents needs to be decrypted
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

refresh

public void refresh()
Displays the PDF document set up by setDocument(PdfDocument) method. Call this method when the PdfDocument object has loaded a new document.


getDocument

public PdfDocument getDocument()
Returns PdfDocument object set up with this viewer.

Returns:
PdfDocument instance set up with this viewer
See Also:
setDocument(PdfDocument)

setDocument

public void setDocument(PdfDocument document)
Set up the viewer with a specified PdfDocument object. Call this method even if no PDF document has been loaded with the PdfDocument object. When a PDF document is loaded with the PdfDocument, the viewer will automatically display the newly loaded document.

If the PdfDocument object had had already loaded a PDF document when calling this method, then the viewer will immediately display that PDF document.

Parameters:
document - document instance associated with the viewer
See Also:
getDocument()

closeDocument

public void closeDocument()
                   throws IOException,
                          PdfException
Stops display of the loaded document and frees all resources used for it.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
See Also:
loadDocument(PdfDocument)

finalize

public void finalize()

getDpi

public int getDpi()
Returns viewer resolution.

Returns:
constant specifying viewer resolution
See Also:
setDpi(int)

setDpi

public void setDpi(int screenDPI)
            throws PdfException
Sets specified viewer resolution.

Parameters:
screenDPI - resolution that needs to be set for the viewer
Throws:
PdfException - if an illegal argument is supplied.

isFontProcessorLibraryLoaded

public static boolean isFontProcessorLibraryLoaded()
Deprecated.  

Returns:

loadFontProcessorLibrary

public static void loadFontProcessorLibrary(String libDirPath)
                                     throws PdfException
Deprecated.  

Returns:
Throws:
PdfException

setViewerChangeHandler

public void setViewerChangeHandler(PdfViewerChangeHandler pdfViewerChangeHandler)
Specifies user class that implements one or more PdfViewerChangeHandler events.

Parameters:
pdfViewerChangeHandler - user class that implements one or more PdfViewerChangeHandler events.

getViewerChangeHandler

public PdfViewerChangeHandler getViewerChangeHandler()
Returns the user class that implements the PdfViewerChangeHandler interface and is set to receive viewer status change events.

Returns:
user class that handles viewer status change events

getPageDisplaySettings

public PdfViewerPageDisplaySettings getPageDisplaySettings()
Returns current default settings of the viewer.

Returns:
a PdfViewerPageDisplaySettings instance representing current default settings of the viewer
See Also:
setPageDisplaySettings(PdfViewerPageDisplaySettings)

setPageDisplaySettings

public void setPageDisplaySettings(PdfViewerPageDisplaySettings pageDisplaySettings)
Sets default settings for the viewer.

Parameters:
pageDisplaySettings - a PdfViewerPageDisplaySettings instance specifying default settings for the viewer

getPageLayout

public int getPageLayout()
Returns current page layout style of the viewer.

Returns:
constant specifying the layout style
See Also:
setPageLayout(int)

setPageLayout

public void setPageLayout(int pageLayout)
                   throws PdfException
Makes the viewer lay out the pages in specified style.

Parameters:
pageLayout - constant specifying the layout style
Throws:
PdfException - if an illegal argument is supplied.

getPageColumnsCustomCount

public int getPageColumnsCustomCount()
Returns number of pages that the viewer displays in a row.

Returns:
number of pages that the viewer displays in a row.
See Also:
setPageColumnsCustomCount(int)

setPageColumnsCustomCount

public void setPageColumnsCustomCount(int pageColumnsCustomCount)
                               throws PdfException
Sets number of pages that viewer displays in a row.

Parameters:
pageColumnsCustomCount - number of pages that the viewer displays in a row
Throws:
PdfException - if an illegal argument is supplied.
See Also:
getPageColumnsCustomCount()

isShowGapsBetweenPages

public boolean isShowGapsBetweenPages()
Returns whether viewer displays insets (margins or empty spaces) between pages.

Returns:
true if displays space; false if otherwise
See Also:
setShowGapsBetweenPages(boolean)

setShowGapsBetweenPages

public void setShowGapsBetweenPages(boolean showGapsBetweenPages)
                             throws PdfException
Makes the viewer display insets (margins or empty spaces) between pages.

Parameters:
showGapsBetweenPages - true if space is required; false if otherwise
Throws:
PdfException - if an illegal argument is supplied.
See Also:
isShowGapsBetweenPages()

isShowPageBordersWhenNoPageGaps

public boolean isShowPageBordersWhenNoPageGaps()
Returns whether the viewer displays visible borders around the pages when it does not place insets around the pages.

Returns:
true if the viewer displays the borders; false if otherwise
See Also:
setShowPageBordersWhenNoPageGaps(boolean)

setShowPageBordersWhenNoPageGaps

public void setShowPageBordersWhenNoPageGaps(boolean showPageBordersWhenNoPageGaps)
                                      throws PdfException
Sets whether viewer displays visible borders around the pages when it does not place insets around the pages.

Parameters:
showPageBordersWhenNoPageGaps - true if borders are required; false if otherwise
Throws:
PdfException - if an illegal argument is supplied.

isShowCoverPageDuringSideBySide

public boolean isShowCoverPageDuringSideBySide()
Returns whether the first page of the document is set to be displayed singly.

Returns:
whether the first page of the document is set to be displayed singly
See Also:
setShowCoverPageDuringSideBySide(boolean)

setShowCoverPageDuringSideBySide

public void setShowCoverPageDuringSideBySide(boolean showCoverPageDuringSideBySide)
                                      throws PdfException
Sets whether the first page need to be displayed singly when pages are displayed side by side.

Parameters:
showCoverPageDuringSideBySide - whether the first page need to be displayed singly
Throws:
PdfException - if pages are not set to be displayed side by side.
See Also:
isShowCoverPageDuringSideBySide()

getMinZoomVal

public double getMinZoomVal()
Returns minimum zoom that the viewer will display a page with.

Returns:
percentage of the zoom
See Also:
getMaxZoomVal(), getPredefinedZoomValues(), zoomIn(), zoomOut()

getMaxZoomVal

public double getMaxZoomVal()
Returns maximum zoom that the viewer will display a page with.

Returns:
percentage of the zoom
See Also:
getMinZoomVal(), getPredefinedZoomValues(), zoomIn(), zoomOut()

zoomIn

public void zoomIn()
            throws PdfException
Makes the viewer increase the current zoom level to the next standard zoom value.

Throws:
PdfException - if an illegal argument is supplied.
See Also:
getPredefinedZoomValues()

zoomOut

public void zoomOut()
             throws PdfException
Makes the viewer increase the current zoom level to the next standard zoom value.

Throws:
PdfException - if an illegal argument is supplied.
See Also:
getPredefinedZoomValues()

getPredefinedZoomValues

public double[] getPredefinedZoomValues()
Returns standard zoom zoom factors supported by the viewer. These zoom values are also used by zoomIn() and zoomOut() methods when the increase or decrease the zoom.

Returns:
array containing the standard zoom values

getMouseInteractivityMode

public int getMouseInteractivityMode()
Returns mouse interactivity mode of the viewer.

Returns:
constant specifying mouse interactivity mode of the viewer
See Also:
setMouseInteractivityMode(int)

setMouseInteractivityMode

public void setMouseInteractivityMode(int cursorMode)
                               throws PdfException
Specify mouse interactivity mode of the viewer.

Parameters:
cursorMode - constant specifying mouse interactivity mode for the viewer
Throws:
PdfException - if an illegal argument is supplied.
See Also:
getMouseInteractivityMode()

showNavigationPanel

public void showNavigationPanel(boolean showNavigationPanel)
Sets whether viewer display its navigation panel.

Parameters:
showNavigationPanel - true makes the viewer display the navigation panel; false disables the display of the navigation panel

isShowPageNumberLabelOnScrolling

public boolean isShowPageNumberLabelOnScrolling()
Returns whether the viewer displays a floating indicator for the current page number when the user scrolls the document.

Returns:
true if page number is displayed; false if otherwise.
See Also:
setShowPageNumberLabelOnScrolling(boolean)

setShowPageNumberLabelOnScrolling

public void setShowPageNumberLabelOnScrolling(boolean showPageNumberLabelOnScrolling)
Specifies whether the viewer displays a floating indicator for the current page number when the user scrolls the document.

Parameters:
showPageNumberLabelOnScrolling -
See Also:
isShowPageNumberLabelOnScrolling()

isShowPagePreviewOnScrolling

public boolean isShowPagePreviewOnScrolling()
Returns whether the viewer displays a floating page preview of the current page when the user scrolls the document.

Returns:
whether the viewer displays a page preview when the user scrolls the document

setShowPagePreviewOnScrolling

public void setShowPagePreviewOnScrolling(boolean showPagePreviewOnScrolling)
Sets whether viewer will display a page preview when the user scrolls the document. This setting is applicable for single page and side-by-side page layouts.

Parameters:
showPagePreviewOnScrolling - true ensures the preview will be displayed; false does otherwise

setViewHistoryItemsLimit

public void setViewHistoryItemsLimit(int historyItemsLimit)
Sets specified limit to the navigation history of the viewer.

Parameters:
historyItemsLimit - maxiumum number of views that need to be allowed in the navigation history

getViewHistoryItemsLimit

public int getViewHistoryItemsLimit()

hasPreviousView

public boolean hasPreviousView()
Returns whether a previous view exists in the navigation history for the document.

Returns:
true if a previous view exists; false if otherwise

hasNextView

public boolean hasNextView()
Returns whether a next view exists in the navigation history for the document.

Returns:
true if a next view exists; false if otherwise

previousView

public void previousView()
                  throws IOException,
                         PdfException
Makes the viewer to display the previous view in the navigation history of the current document.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

nextView

public void nextView()
              throws IOException,
                     PdfException
Makes the viewer to display the next view in the navigation history of the current document.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

setRenderErrorHandler

public void setRenderErrorHandler(PdfRenderErrorHandler pdfRenderErrorHandler)
Sets specified user class that needs to handle rendering errors of the viewer.

Parameters:
pdfRenderErrorHandler - user class that implements PdfRenderErrorHandler

getRenderErrorHandler

public PdfRenderErrorHandler getRenderErrorHandler()
Returns user class that handles rendering errors of the viewer.

Returns:
user class that implements PdfRenderErrorHandler

dispose

public void dispose()
             throws IOException,
                    PdfException
Closes any loaded document and releases threads pools created by the viewer. Usually, there is no need to call this method, as the the thread pool is automatically destroyed when the viewer is destroyed. However, to retain the viewer object in memory but release thread resources when a document is closed, call this method. If the viewer is made to load another document, it will create a fresh thread pool. That, however, is an expensive operation.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

Gnostice PDFOne
Pro. Ed. v5.0.0

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2010 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com