Class IPdfviewerController

java.lang.Object
org.zkoss.stateless.state.IPdfviewerController

public class IPdfviewerController extends Object
An IPdfviewer 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 Details

    • of

      public static IPdfviewerController of(IPdfviewer owner)
      Returns the controller instance with the given Pdfviewer
      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 org.zkoss.zk.ui.WrongValueException
      Sets the active page (starting from 0).
      Throws:
      org.zkoss.zk.ui.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 or IPdfviewer.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. Only 0, 90, 180 and 270 are accepted.
    • getPageCount

      public int getPageCount()
      Returns the number of pages. Note: there is at least one page even no item at all.