Directory

← Back

FlexPaper Vaadin Wrapper

FlexPaper wrapper for Vaadin

Author

Contributors

Rating

Provides functionality of the open source web based document viewer.

Sample code

public class VaadinFlexpaperApplication extends Application {
  private static final long serialVersionUID = -6330390589556125450L;

  @Override
  public void init() {
    final Window mainWindow = new Window("Vaadin Flexpaper Application");

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);

    Config config = new Config();
    config.setSwfFile("vaadin-flexpaper/VAADIN/docs/Paper.pdf.swf");
    config.setFullScreenAsMaxWindow(true);

    final FlexPaper fp = new FlexPaper(config);
    hl.addComponent(fp);

    VerticalLayout vl = new VerticalLayout();

    hl.addComponent(vl);

    Button loadSwf = new Button("Load SWF");
    loadSwf.addListener(new ClickListener() {
      private static final long serialVersionUID = 7753039995659483482L;

      @Override
      public void buttonClick(ClickEvent event) {
        fp.loadSwf("vaadin-flexpaper/VAADIN/docs/Paper.pdf.swf");
      }
    });
    vl.addComponent(loadSwf);

    Button gotoPage = new Button("Go to page 3");
    gotoPage.addListener(new ClickListener() {
      private static final long serialVersionUID = -1133975523938840106L;

      @Override
      public void buttonClick(ClickEvent event) {
        fp.gotoPage(3);
      }
    });
    vl.addComponent(gotoPage);

    Button fitWidth = new Button("Fit width");
    fitWidth.addListener(new ClickListener() {
      private static final long serialVersionUID = -8133975543928840126L;

      @Override
      public void buttonClick(ClickEvent event) {
        fp.fitWidth();
      }
    });
    vl.addComponent(fitWidth);

    mainWindow.addComponent(hl);

    setMainWindow(mainWindow);
  }

}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Added wrapper for functions API support: gotoPage(Number pageNumber) fitWidth() fitHeight() loadSwf(String swffile) nextPage() prevPage() setZoom(Number factor) searchText(String text) switchMode(String mode) printPaper() highlight(String url) postSnapshot(String url)

Released
2013-10-27
Maturity
EXPERIMENTAL
License
GNU General Public License v3.0 only

Compatibility

Framework
Vaadin 6.0+
Browser
Browser Independent
Online