Skip to content

vaadin-component-factory/vcf-pdf-viewer-flow

Repository files navigation

Pdf Viewer component for Vaadin Flow

This is the server-side component of <vcf-pdf-viewer> Web Component. The component uses PDF.js library to display pdf files.

This component is part of Vaadin Component Factory.

Description

Pdf Viewer component provides support to the following features:

  • Display a pdf file.
  • Display a thumbnail's viewer.
  • Set zoom.
  • Navigate to a certain page.
  • Open or close thumbnail's viewer.
  • Add a listener on change page when clicking on thumbnail.
  • Download the pdf file.

From version 2.5.x:

  • Printing the pdf file (implemented with Print.js).

Development instructions

  • Build the project and install the add-on locally:
mvn clean install
  • For starting the demo server go to pdf-viewer-demo and run:
mvn jetty:run

This deploys demo at http://localhost:8080

How to use it - Example

PdfViewer pdfViewer = new PdfViewer();
StreamResource resource = new StreamResource("example.pdf", () -> getClass().getResourceAsStream("/pdf/example.pdf"));
pdfViewer.setSrc(resource);
pdfViewer.openThumbnailsView();
add(pdfViewer);    

Missing features or bugs

You can report any issue or missing feature on GitHub.

License

Apache License 2.0.