|
Gnostice PDFOne Java
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.gnostice.pdfone.PdfViewer
public class PdfViewer
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.
| Nested Class Summary |
|---|
| Nested classes/interfaces 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 |
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 |
closeDocument()
Removes the display of the document on the viewer. |
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. |
int |
getHorizontalScrollBarPolicy()
Returns horizontal scrollbar policy value. |
int |
getPageCount()
Returns total number of pages in the displayed document. |
int |
getPageView()
Returns how the height and width of the pages are accommodated inside the viewer. |
Dimension |
getPreferredSize()
|
int |
getRotationAngle()
Returns angle of tilt applied to pages when they are displayed. |
int |
getVerticalScrollBarPolicy()
Returns vertical scrollbar policy value. |
Insets |
getViewerInsets()
Returns how the edges of the viewer are padded. |
double |
getZoom()
Returns magnification factor with which pages are displayed. |
void |
lastPage()
Changes the current page to the last page in the document. |
void |
loadDocument(PdfDocument d)
Displays a specified PDF document. |
void |
nextPage()
Changes current page to the one right after it in the document. |
Dimension |
preferredSize()
|
void |
previousPage()
Changes current page to the one right ahead of it in the document. |
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 |
setHorizontalScrollBarPolicy(int hsbPolicy)
Specifies when the horizontal scrollbar appears in the scrollpane. |
void |
setPageView(int PageView)
Specifies how the height and width of the pages need to be accommodated inside the viewer. |
void |
setRotationAngle(int rotation)
Specifies angle of tilt that need to be applied to pages when they are displayed. |
void |
setVerticalScrollBarPolicy(int vsbPolicy)
Specifies when the vertical scrollbar appears in the scrollpane. |
void |
setViewerInsets(Insets insets)
Specfies how the edges of the viewer are padded. |
void |
setZoom(double zoomFactor)
Specifies magnification factor with which pages need to be displayed. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
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 ANGLE_0
public static final int ANGLE_90
public static final int ANGLE_180
public static final int ANGLE_270
| Constructor Detail |
|---|
public PdfViewer()
loadDocument(PdfDocument) to display a PDF document
in the viewer.
| Method Detail |
|---|
public Dimension preferredSize()
preferredSize in class Containerpublic Dimension getPreferredSize()
getPreferredSize in class JComponentpublic 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)
hsbPolicy - ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVERpublic int getHorizontalScrollBarPolicy()
setHorizontalScrollBarPolicy(int)public void setVerticalScrollBarPolicy(int vsbPolicy)
vsbPolicy - ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVERgetVerticalScrollBarPolicy(),
setHorizontalScrollBarPolicy(int),
getHorizontalScrollBarPolicy()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 viewer
PdfException - 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
PdfExceptionpreviousPage(),
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
displayed
PdfException - if an illegal argument is supplied.getZoom()public double getZoom()
setZoom(double)
public void setRotationAngle(int rotation)
throws PdfException
rotation - angle of the tilt
PdfException - 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
displayed
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.getCurrentPage()public int getCurrentPage()
setCurrentPage(int)public int getPageCount()
public void setViewerInsets(Insets insets)
insets - how the edges of the viewer are paddedgetViewerInsets(),
Insetspublic Insets getViewerInsets()
setViewerInsets(Insets),
Insets
public void loadDocument(PdfDocument d)
throws IOException,
PdfException
d - PDF document that needs to be displayed
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.setCurrentPage(int)public void closeDocument()
loadDocument(PdfDocument)
|
Std. Ed. v2.10 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||