From e5b996612298188d00c6923a82e1c29f560a341b Mon Sep 17 00:00:00 2001 From: Paola De Bartolo Date: Fri, 6 Dec 2024 09:08:56 -0300 Subject: [PATCH] feat(demo): add demo for rotate options --- .../pdfviewer/MainLayout.java | 4 +++- .../pdfviewer/WithRotateOptionsExample.java | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/WithRotateOptionsExample.java diff --git a/vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/MainLayout.java b/vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/MainLayout.java index 1155245..e30a5c9 100644 --- a/vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/MainLayout.java +++ b/vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/MainLayout.java @@ -33,11 +33,13 @@ public MainLayout() { new RouterLink("Without zoom dropdown", WithoutZoomDropdownExample.class); final RouterLink sourceChangeExample = new RouterLink("Source change", SourceChangeExample.class); + final RouterLink withRotateOptionsExample = + new RouterLink("With rotate options", WithRotateOptionsExample.class); final VerticalLayout menuLayout = new VerticalLayout(basicExample, zoomExample, thumbnailsOpenExample, thumbnailsListenerExample, selectPageExample, customAutoFitZoomLabelsExample, withoutDownloadExample, customTitleExample, withPrintOptionExample, - renderingInteractiveFormsExample, withoutZoomDropdownExample, sourceChangeExample); + renderingInteractiveFormsExample, withoutZoomDropdownExample, sourceChangeExample, withRotateOptionsExample); addToDrawer(menuLayout); addToNavbar(drawerToggle); } diff --git a/vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/WithRotateOptionsExample.java b/vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/WithRotateOptionsExample.java new file mode 100644 index 0000000..58550b7 --- /dev/null +++ b/vcf-pdf-viewer-demo/src/main/java/com/vaadin/componentfactory/pdfviewer/WithRotateOptionsExample.java @@ -0,0 +1,21 @@ +package com.vaadin.componentfactory.pdfviewer; + +import com.vaadin.flow.component.html.Div; +import com.vaadin.flow.router.Route; +import com.vaadin.flow.server.StreamResource; + +@Route(value = "with-rotate-options", layout = MainLayout.class) +public class WithRotateOptionsExample extends Div { + + public WithRotateOptionsExample() { + + PdfViewer pdfViewer = new PdfViewer(); + pdfViewer.setSizeFull(); + StreamResource resource = new StreamResource("example.pdf", () -> getClass().getResourceAsStream("/pdf/example.pdf")); + pdfViewer.setSrc(resource); + pdfViewer.setAddRotateClockwiseButton(true); + pdfViewer.setAddRotateCounterClockwiseButton(true); + add(pdfViewer); + } + +}