Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Report Preview in PDF from JSF page
Report Preview in PDF from JSF page [message #1771249] Wed, 23 August 2017 11:28
Priom Biswas is currently offline Priom BiswasFriend
Messages: 1
Registered: August 2017
Junior Member

Currently I am developing an application which will show BIRT Report when user clicks preview report button.
Following is my java code for pdf generation.
private String rptFileLocation = "D:/Java Development/Projects/CustomerSubReport.rptdesign";
    private String pdfDownloadLocation = "E://logs/customer_subreport.pdf";
public void previewReportInPdf(String rptFileLocation, String pdfDownloadLocation) throws EngineException{
        IReportEngine engine = null;
        EngineConfig config = null;
        try{
            config = new EngineConfig();
            config.setLogConfig("E://logs", Level.FINEST);
            Platform.startup(config);
            IReportEngineFactory factory = 
                    (IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
            engine = factory.createReportEngine(config);
            IReportRunnable design = null;
            design = engine.openReportDesign(rptFileLocation);
            IRunAndRenderTask task = engine.createRunAndRenderTask(design);
            PDFRenderOption options = new PDFRenderOption();
            options.setOutputFileName(pdfDownloadLocation);
            options.setOutputFormat("pdf");
            task.setRenderOption(options);
            task.run();
            task.close();
            engine.destroy();
        }
        catch(Exception ex){
            ex.printStackTrace();
        }
        finally{
            Platform.shutdown();
        }
    }


Following is the jsf code segment
<h:commandButton value="Preview Report(PDF)" action="#{birtBean.previewReportInPdf()}" ></h:commandButton>


Currently the pdf is downloading in the specified path of my disk. I want to display the report as pdf in new browser tab. How can I achieve this?
Previous Topic:Suppress printing of the line at the top of a PDF
Next Topic:BIRT: Problems with DataSets/data is not displayed in several reports
Goto Forum:
  


Current Time: Sat Feb 24 03:40:48 GMT 2018

Powered by FUDForum. Page generated in 0.02202 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software