简体   繁体   中英

DynamicReports with JSF 2 and PrimeFaces

I'm working on project that needs to integrate DynamicReport with PrimeFaces.
My Question : Is there any way to show the report inside PrimeFace Panel not opened in new page.

If possible , Please full example to do that,

Thank you

Here is a example:

ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
        DynamicReports.report()
                .setTemplate(Templates.reportTemplate)
                .columns(stateColumn, statePorc)
                .title(Templates.createTitleComponent2("Tittle"))
                .summary(
                        DynamicReports.cht.pie3DChart()
                        .setTitleFont(boldFont)
                        .seriesColorsByName(seriesColors)
                        .setKey(stateColumn)
                        .series(
                                DynamicReports.cht.serie(itemColumn).setSeries(stateColumn)
                        )
                )
                .pageFooter(Templates.footerComponent)
                .setDataSource(createDataSource4())
                .toPdf(baos);
        InputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
        barStream = new DefaultStreamedContent(inputStream, "application/pdf", "example.pdf");
        setBarStream(barStream);
    } catch (DRException e) {
        e.printStackTrace();
    }

And here is the view:

<p:dialog resizable="false" closeOnEscape="false" draggable="false" appendTo="@(body)" modal="true" id="pdfViewer" widgetVar="pdfModal" width="1220px" height="730px" style="z-index: 999;">
                <p:media cache="false" value="#{yourBean.barStream}" width="100%" height="720px" player="pdf"/>
            </p:dialog>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM