public class PdfViewer extends JPanel implements MouseListener, ComponentListener, MouseMotionListener, MouseWheelListener, AdjustmentListener, Serializable
PdfViewer
object can be used to display
a document only in
reading mode
.JComponent.AccessibleJComponent
Component.BaselineResizeBehavior
Modifier and Type | Field and Description |
---|---|
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
Deprecated.
|
static int |
MOUSE_INTERACTIVITY_MODE_MARQUEE_RECT |
static int |
MOUSE_INTERACTIVITY_MODE_NONE
Deprecated.
|
static int |
MOUSE_INTERACTIVITY_MODE_PAN |
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.
|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
PdfViewer()
Zero-argument default constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
MouseActivityHandler |
getMouseActivityHandler() |
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.
|
PdfViewerPageHandler |
getViewerPageHandler() |
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 |
setMouseActivityHandler(MouseActivityHandler mouseActivityHandler)
Specifies user class whose
MouseActivityHandler.onMouseActivity(MouseActivityEvent)
needs to be called when mouse activity is detected on the viewer. |
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 |
setViewerPageHandler(PdfViewerPageHandler viewerPageHandler) |
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.
|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int DPI_72
getDpi()
,
setDpi(int)
,
Constant Field Valuespublic static final int DPI_96
getDpi()
,
setDpi(int)
,
Constant Field Valuespublic static final int DPI_110
getDpi()
,
setDpi(int)
,
Constant Field Valuespublic static final int MOUSE_INTERACTIVITY_MODE_NONE
public static final int MOUSE_INTERACTIVITY_MODE_MARQUEE_RECT
public static final int MOUSE_INTERACTIVITY_MODE_DEFAULT
public static final int MOUSE_INTERACTIVITY_MODE_PAN
public static final int PAGEVIEW_ACTUAL_SIZE
public static final int PAGEVIEW_FIT_PAGE
public static final int PAGEVIEW_FIT_WIDTH
public static final int PAGEVIEW_CUSTOM
PAGEVIEW_ACTUAL_SIZE
, PAGEVIEW_FIT_PAGE
, or
PAGEVIEW_FIT_WIDTH
.setZoom(double)
,
getZoom()
,
Constant Field Valuespublic static final int LAYOUT_SINGLE_PAGE
public static final int LAYOUT_SINGLE_PAGE_CONTINUOUS
public static final int LAYOUT_SIDE_BY_SIDE
public static final int LAYOUT_SIDE_BY_SIDE_CONTINUOUS
public static final int LAYOUT_AUTO_FIT_COLUMNS_IN_WINDOW
public static final int LAYOUT_USER_DEFINED
setPageColumnsCustomCount(int)
.public static final int ANGLE_0
public static final int ANGLE_90
public static final int ANGLE_180
public static final int ANGLE_270
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public Dimension preferredSize()
preferredSize
in class Container
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void setViewerScrollPane(JScrollPane jScrollPane)
jScrollPane
- scroll pane to which this viewer needs to be added.public void adjustmentValueChanged(AdjustmentEvent e)
adjustmentValueChanged
in interface AdjustmentListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void setBackgroundColor(Color bg)
bg
- background color of the space between the edges of
the viewer and displayed PDF documentgetBackgroundColor()
public Color getBackgroundColor()
setBackgroundColor(Color)
public void setHorizontalScrollBarPolicy(int hsbPolicy)
public int getHorizontalScrollBarPolicy()
setHorizontalScrollBarPolicy(int)
public void setVerticalScrollBarPolicy(int vsbPolicy)
public int getVerticalScrollBarPolicy()
getVerticalScrollBarPolicy()
,
setHorizontalScrollBarPolicy(int)
,
getHorizontalScrollBarPolicy()
public void setPageView(int pageView) throws PdfException
pageView
- constant specifying how the height and width of the
pages need to be accommodated inside the viewerPdfException
- if an illegal argument is supplied.PAGEVIEW_ACTUAL_SIZE
,
PAGEVIEW_FIT_PAGE
,
PAGEVIEW_FIT_WIDTH
,
PAGEVIEW_CUSTOM
,
getPageView()
,
setZoom(double)
public int getPageView()
PAGEVIEW_ACTUAL_SIZE
,
PAGEVIEW_FIT_PAGE
,
PAGEVIEW_FIT_WIDTH
,
PAGEVIEW_CUSTOM
,
setPageView(int)
,
setZoom(double)
public void rotateClockwise() throws PdfException
PdfException
- if an illegal argument is supplied.rotateCounterClockwise()
public void rotateCounterClockwise() throws PdfException
PdfException
- if an illegal argument is supplied.rotateClockwise()
public void previousPage() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.nextPage()
,
firstPage()
,
lastPage()
,
setCurrentPage(int)
public void nextPage() throws IOException, PdfException
IOException
PdfException
previousPage()
,
firstPage()
,
lastPage()
,
setCurrentPage(int)
public void firstPage() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.lastPage()
,
previousPage()
,
nextPage()
,
setCurrentPage(int)
public void lastPage() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.firstPage()
,
previousPage()
,
nextPage()
,
setCurrentPage(int)
public void setZoom(double zoomFactor) throws PdfException
zoomFactor
- magnification factor with which pages need to be
displayedPdfException
- if an illegal argument is supplied.getZoom()
public double getZoom()
setZoom(double)
public void setRotationAngle(int rotation) throws PdfException
rotation
- angle of the tiltPdfException
- if an illegal argument is supplied.ANGLE_0
,
ANGLE_90
,
ANGLE_180
,
ANGLE_270
,
getRotationAngle()
public int getRotationAngle()
setRotationAngle(int)
public void setCurrentPage(int pageNum) throws IOException, PdfException
pageNum
- number of the page that needs to be currently
displayedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.getCurrentPage()
public void setCurrentPage(int pageNum, Point location) throws IOException, PdfException
pageNum
- number of the pagelocation
- location where the top-left corner of the viewer
needs to be positionedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setCurrentPage(int pageNum, Point location, double zoom) throws IOException, PdfException
pageNum
- number of the pagelocation
- location where the top-left corner of the viewer
needs to be positionedzoom
- magnification of the pageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setCurrentPage(int pageNum, Rectangle2D rect) throws IOException, PdfException
pageNum
- number of the pagerect
- area that needs to be displayed on the pageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public int getCurrentPage()
setCurrentPage(int)
public int getPageCount()
public void setViewerInsets(Insets insets) throws PdfException
insets
- how the edges of the viewer are paddedPdfException
getViewerInsets()
,
Insets
public Insets getViewerInsets()
setViewerInsets(Insets)
,
Insets
public void setScrollMode(int scrollMode)
scrollMode
- one of the following constants specifying how the viewer scrolls its
contents
getScrollMode()
public int getScrollMode()
getScrollMode()
public void loadDocument(PdfDocument d) throws IOException, PdfException
setDocument(PdfDocument)
instead.
Displays a specified PDF document.d
- PDF document that needs to be displayedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.setCurrentPage(int)
public void loadDocument(String inFilePath) throws IOException, PdfException
inFilePath
- pathname of the document that needs to be displayedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void loadDocument(String inFilePath, String password) throws IOException, PdfException
inFilePath
- pathname of the document that needs to be displayedpassword
- password with which it needs to be displayedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void loadDocument(File inFile) throws IOException, PdfException
java.io.File
object and display its contents in the viewer.inFile
- PDF document that needs to be displayedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void loadDocument(File inFile, String password) throws IOException, PdfException
java.io.File
object, decrypt it with specified
password, and display its contents in the viewer.inFile
- PDF document that needs to be displayedpassword
- password with which the document needs to be
decryptedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void loadDocument(FileInputStream fileInputStream) throws IOException, PdfException
java.io.FileInputStream
object and display its contents.fileInputStream
- PDF document that needs to be displayedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void loadDocument(FileInputStream fileInputStream, String password) throws IOException, PdfException
java.io.FileInputStream
object, decrypt it with
specified password and display its contents in the viewer.fileInputStream
- PDF document that needs to be displayedpassword
- password with which the document's contents needs to
be decryptedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void loadDocument(byte[] byteArray) throws IOException, PdfException
byteArray
- byte array that contains the PDF documentIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void loadDocument(byte[] byteArray, String password) throws IOException, PdfException
byteArray
- byte array that contains the PDF documentpassword
- password with which the document's contents needs to
be decryptedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void refresh()
setDocument(PdfDocument)
method. Call this method when the PdfDocument
object has
loaded a new document.public PdfDocument getDocument()
PdfDocument
object set up with this
viewer.PdfDocument
instance set up with this viewersetDocument(PdfDocument)
public void setDocument(PdfDocument document)
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.
document
- document instance associated with the viewergetDocument()
public void closeDocument() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.loadDocument(PdfDocument)
public int getDpi()
constant
specifying viewer resolutionsetDpi(int)
public void setDpi(int screenDPI) throws PdfException
screenDPI
- resolution that needs to be set for the viewerPdfException
- if an illegal argument is supplied.public static boolean isFontProcessorLibraryLoaded()
public static void loadFontProcessorLibrary(String libDirPath) throws PdfException
PdfException
public void setViewerChangeHandler(PdfViewerChangeHandler pdfViewerChangeHandler)
PdfViewerChangeHandler
events.pdfViewerChangeHandler
- user class that implements one or more
PdfViewerChangeHandler
events.public PdfViewerChangeHandler getViewerChangeHandler()
PdfViewerChangeHandler
interface and is set to receive
viewer status change events.public PdfViewerPageDisplaySettings getPageDisplaySettings()
PdfViewerPageDisplaySettings
instance
representing current default settings of the viewersetPageDisplaySettings(PdfViewerPageDisplaySettings)
public void setPageDisplaySettings(PdfViewerPageDisplaySettings pageDisplaySettings)
pageDisplaySettings
- a PdfViewerPageDisplaySettings
instance specifying default settings for the viewerpublic int getPageLayout()
constant
specifying the layout stylesetPageLayout(int)
public void setPageLayout(int pageLayout) throws PdfException
pageLayout
- constant
specifying the layout stylePdfException
- if an illegal argument is supplied.public int getPageColumnsCustomCount()
setPageColumnsCustomCount(int)
public void setPageColumnsCustomCount(int pageColumnsCustomCount) throws PdfException
pageColumnsCustomCount
- number of pages that the viewer displays in a rowPdfException
- if an illegal argument is supplied.getPageColumnsCustomCount()
public boolean isShowGapsBetweenPages()
true
if displays space;
false
if otherwisesetShowGapsBetweenPages(boolean)
public void setShowGapsBetweenPages(boolean showGapsBetweenPages) throws PdfException
showGapsBetweenPages
- true
if space is required;
false
if otherwisePdfException
- if an illegal argument is supplied.isShowGapsBetweenPages()
public boolean isShowPageBordersWhenNoPageGaps()
true
if the viewer displays the borders;
false
if otherwisesetShowPageBordersWhenNoPageGaps(boolean)
public void setShowPageBordersWhenNoPageGaps(boolean showPageBordersWhenNoPageGaps) throws PdfException
showPageBordersWhenNoPageGaps
- true
if borders are required;
false
if otherwisePdfException
- if an illegal argument is supplied.public boolean isShowCoverPageDuringSideBySide()
setShowCoverPageDuringSideBySide(boolean)
public void setShowCoverPageDuringSideBySide(boolean showCoverPageDuringSideBySide) throws PdfException
showCoverPageDuringSideBySide
- whether the first page need to be displayed singlyPdfException
- if pages are not set to be displayed side by side.isShowCoverPageDuringSideBySide()
public double getMinZoomVal()
getMaxZoomVal()
,
getPredefinedZoomValues()
,
zoomIn()
,
zoomOut()
public double getMaxZoomVal()
getMinZoomVal()
,
getPredefinedZoomValues()
,
zoomIn()
,
zoomOut()
public void zoomIn() throws PdfException
PdfException
- if an illegal argument is supplied.getPredefinedZoomValues()
public void zoomOut() throws PdfException
PdfException
- if an illegal argument is supplied.getPredefinedZoomValues()
public double[] getPredefinedZoomValues()
zoomIn()
and
zoomOut()
methods when the increase or decrease the
zoom.public int getMouseInteractivityMode()
constant
specifying mouse interactivity mode of the viewersetMouseInteractivityMode(int)
public void setMouseInteractivityMode(int cursorMode) throws PdfException
cursorMode
- constant
specifying mouse interactivity mode for the viewerPdfException
- if an illegal argument is supplied.getMouseInteractivityMode()
public void showNavigationPanel(boolean showNavigationPanel)
showNavigationPanel
- true
makes the viewer display the
navigation panel; false
disables the
display of the navigation panelpublic boolean isShowPageNumberLabelOnScrolling()
setShowPageNumberLabelOnScrolling(boolean)
public void setShowPageNumberLabelOnScrolling(boolean showPageNumberLabelOnScrolling)
showPageNumberLabelOnScrolling
- isShowPageNumberLabelOnScrolling()
public boolean isShowPagePreviewOnScrolling()
public void setShowPagePreviewOnScrolling(boolean showPagePreviewOnScrolling)
showPagePreviewOnScrolling
- true
ensures the preview will be
displayed; false
does otherwisepublic void setViewHistoryItemsLimit(int historyItemsLimit)
historyItemsLimit
- maxiumum number of views that need to be allowed in the
navigation historypublic int getViewHistoryItemsLimit()
public boolean hasPreviousView()
true
if a previous view exists;
false
if otherwisepublic boolean hasNextView()
true
if a next view exists;
false
if otherwisepublic void previousView() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void nextView() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setRenderErrorHandler(PdfRenderErrorHandler pdfRenderErrorHandler)
pdfRenderErrorHandler
- user class that implements PdfRenderErrorHandlerpublic PdfRenderErrorHandler getRenderErrorHandler()
public void dispose() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setViewerPageHandler(PdfViewerPageHandler viewerPageHandler)
public PdfViewerPageHandler getViewerPageHandler()
public MouseActivityHandler getMouseActivityHandler()
public void setMouseActivityHandler(MouseActivityHandler mouseActivityHandler)
MouseActivityHandler.onMouseActivity(MouseActivityEvent)
needs to be called when mouse activity is detected on the viewer.mouseActivityHandler
- user class implementing
MouseActivityHandler.onMouseActivity(MouseActivityEvent)