Class PrintPreviewReport

Can some one give me an example of how this method exactly works PrintPreviewReport Method:downloadCsvOnClick exactly work? I did the following:

    SerializableSupplier<List<? extends PrintData>> its=null;
   
        its= ()->dbPDFList;//implements the Abstract Method
		
		report.downloadCsvOnClick(report, "jasperCSV.CSV", its);//WHAT HAPPENS HERE???

Looking at the source code here: https://github.com/alejandro-du/report-ui/blob/vaadin8/src/main/java/org/vaadin/reports/PrintPreviewReport.java

it seems that downloadCsvOnClick takes a Component and uses FileDownloader to extend it so that clicking the component causes a download. The downloadable file is created with the filename passed as the second parameter of downloadCsvOnClick (in your case jasperCSV.CSV).

The file content is defined by the items provided by the SerializableSupplier parameter (in your case, its). The InputStream needed to create the file is generated with the help of a JRCsvExporter in the getStream method: https://github.com/alejandro-du/report-ui/blob/vaadin8/src/main/java/org/vaadin/reports/PrintPreviewReport.java#L205

The demo project in the sources has an example of the usage here: https://github.com/alejandro-du/report-ui/blob/vaadin8/src/test/java/org/vaadin/reports/TestUI.java#L165

Thanks Olli that saved me a lot of time. And the code is beautifully written by Alejandro!

I ran the method all works well except the pdf. i get the following when i try to download the pdf version for the export:

net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font:
pdfFontName: Verdana
pdfEncoding: CP1252
isPdfEmbedded : true
at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2323)
at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:2109)
at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:2078)
at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.getPhrase(SimplePdfTextRenderer.java:64)
at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.render(SimplePdfTextRenderer.java:72)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2438)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:1097)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:1056)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:920)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:537)
at org.vaadin.reports.PrintPreviewReport.getStream(PrintPreviewReport.java:212)
at org.vaadin.reports.PrintPreviewReport.getPdfStream(PrintPreviewReport.java:174)
at org.vaadin.reports.PrintPreviewReport.lambda$downloadPdfOnClick$17bdf362$1(PrintPreviewReport.java:121)
at com.vaadin.server.StreamResource.getStream(StreamResource.java:143)
at com.vaadin.server.FileDownloader.handleConnectorRequest(FileDownloader.java:167)
at com.vaadin.server.ConnectorResourceHandler.handleRequest(ConnectorResourceHandler.java:90)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1602)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:445)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:748)

This seems to be an issue with JasperReports configuration; ensure that Verdana font is available to the JVM or, better, use [Font Extension]
(http://jasperreports.sourceforge.net/sample.reference/fonts/)

Marco Collovati:
This seems to be an issue with JasperReports configuration; ensure that Verdana font is available to the JVM or, better, use [Font Extension]
(http://jasperreports.sourceforge.net/sample.reference/fonts/)

I have no idea how to use this suggestion. I am using NetBeans and I am guessing i need to install the extension libraries and then include them at compile time.

But where are these JAR files?"

A step by step answer will be appreciated.

Thanks

SOLVED!!!

DO NOT USE THE FOLLOWING:

Style titleStyle = new Style(“titleStyle”);
titleStyle.setFont(new Font(18, Font._FONT_ARIAL, true));
**

USE:

	Style titleStyle = new Style("titleStyle");
    titleStyle.setFont(Font.ARIAL);