Package org.zkoss.stateless.state
Class IPdfviewerController
- java.lang.Object
-
- org.zkoss.stateless.state.IPdfviewerController
-
public class IPdfviewerController extends java.lang.Object
AnIPdfviewer
controller to control zoom, rotate, navigating pages and some status with the given PDF viewer instance.Note: this class is not thread-safe, so when it's used in multi-threading environment, the developer should handle the threading issue.
- Author:
- katherine
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IPdfviewer
build()
Returns the immutable Pdfviewer instance that the controller to build with.void
firstPage()
Goes to the first page.int
getActivePage()
Returns the active page (starting from 0).int
getPageCount()
Returns the number of pages.int
getRotation()
Returns the rotation angle.double
getZoom()
Returns the zoom level.void
lastPage()
Goes to the last page.void
nextPage()
Goes to the next page.static IPdfviewerController
of(IPdfviewer owner)
Returns the controller instance with the givenPdfviewer
void
previousPage()
Goes to the previous page.void
rotateClockwise()
Rotates 90 degrees clockwise.void
rotateCounterclockwise()
Rotates 90 degrees counterclockwise.void
setActivePage(int page)
Sets the active page (starting from 0).void
setRotation(int rotation)
Sets the rotation angle.void
setZoom(double zoom)
Sets the zoom level.void
setZoom(IPdfviewer.ZoomMode zoomMode)
Sets the zoom level.void
zoomIn()
Zooms in by 10%.void
zoomOut()
Zooms out by 10%.
-
-
-
Method Detail
-
of
public static IPdfviewerController of(IPdfviewer owner)
Returns the controller instance with the givenPdfviewer
- Parameters:
owner
- The controller to control with
-
build
public IPdfviewer build()
Returns the immutable Pdfviewer instance that the controller to build with.
-
firstPage
public void firstPage()
Goes to the first page.
-
previousPage
public void previousPage()
Goes to the previous page.
-
nextPage
public void nextPage()
Goes to the next page.
-
lastPage
public void lastPage()
Goes to the last page.
-
zoomIn
public void zoomIn()
Zooms in by 10%.
-
zoomOut
public void zoomOut()
Zooms out by 10%.
-
rotateClockwise
public void rotateClockwise()
Rotates 90 degrees clockwise.
-
rotateCounterclockwise
public void rotateCounterclockwise()
Rotates 90 degrees counterclockwise.
-
getActivePage
public int getActivePage()
Returns the active page (starting from 0).
-
setActivePage
public void setActivePage(int page) throws WrongValueException
Sets the active page (starting from 0).- Throws:
WrongValueException
-
getZoom
public double getZoom()
Returns the zoom level.Default:
1.0
.
-
setZoom
public void setZoom(double zoom)
Sets the zoom level.
-
setZoom
public void setZoom(IPdfviewer.ZoomMode zoomMode)
Sets the zoom level.- Parameters:
zoomMode
-IPdfviewer.ZoomMode.FIT_PAGE_HEIGHT
orIPdfviewer.ZoomMode.FIT_PAGE_WIDTH
-
getRotation
public int getRotation()
Returns the rotation angle.Default:
0
.
-
setRotation
public void setRotation(int rotation)
Sets the rotation angle.- Parameters:
rotation
- rotation angle. Only0
,90
,180
and270
are accepted.
-
getPageCount
public int getPageCount()
Returns the number of pages. Note: there is at least one page even no item at all.
-
-