Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

MinimalViewer

Patrick edited this page Oct 1, 2021 · 5 revisions

The MinimalViewer is the minimal version of a PDF viewer. It will just show you the current page of the pdf. The viewer of the style is that it will just show a single page which can be switched by pressing the arrow keys or just simple scrolling. When you reach the end or the beginning of a page it will switch to the page before or next to the current page. You can zoom in/out by pressing your control button and scroll with your mouse wheel.

Usage

Declaration

// You need a PDF for the MinimalViewer
PDF pdf = new PDF(new File(path));
// With constructor
MinimalViewer mv = new MinimalViewer(pdf);
// With MinimalViewerBuilder
MinimalViewer mv = new MinimalViewer.MinimalViewerBuilder().
    .setPDF(pdf)
    .setAppearanceType(AppearanceType.Dark)
    .setCustomPath(path)
    .build();

Appearance Type

There are three types:

DARK

The dark mode will change the color of the background and the scrollbar with a darker color.
Screenshot: tbd.

LIGHT

The dark mode will change the color of the background and the scrollbar with a lighter color.
Screenshot: tbd.

CUSTOM

If you set the Appearance Type to CUSTOM, you will provide a path to your .css file. Note that this is currently not tested!

Events

You can add an EventHandler where you can listen to the events which are triggered by the MinimalViewer.

mv.addEventHandler(ViewerEvent.VIEWER_EVENT_TYPE, new ViewerEventHandler() {
   @Override
   public void onViewerEvent(@NonNull Parameter parameter) {
      // Your code here
   }
});

There are several "Parameter" which trigger an event:

  • BEGIN: The begin of the pdf is reached
  • END: The end of the pdf is reached
  • LEFT: The page will be switched to the page before
  • RIGHT: The page will be switched to the next page
  • PDF_LOADED: A new pdf will be loaded by the viewer
  • RENDER: The viewer render a new image of the pdf
  • THEME_CHANGED: The AppearanceType has been changed

Screenshots

Dark Theme

Screenshot of the MinimalViewer with the dark theme

Light Theme

Screenshot of the MinimalViewer with the light theme