Problems with jasper report pdf exporting

Hello,
I coded a simple servlet to view a jasper report (created with iReport) after clicking on the right button in the jsp.
Here is the problem:
net.sf.jasperreports.engine.JRRuntimeException: Error evaluating expression :
     Source text : (java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{"chartName=Pie3D","depthFactor=0.2","titlePosition=1","width=245","plotBackground=[255,255,255]","serie1=SERIE_CONTA_RISPOSTE","serie0=SERIE_RISPOSTA","foregroundAlpha=0.33","tooltips=false","chartBackground=[255,255,255]","subtitle=","title=","legend=true","quality=2","height=168","antialias=true"}, (it.businesslogic.ireport.IReportScriptlet)$P{REPORT_SCRIPTLET})
     net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:604)
     net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:343)
     net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)
     net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)
     net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1302)
     net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)
     net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:228)
     net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
     net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:730)
     net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:632)
     net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
     net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
     net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
     net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:203)
     customer_care.servlet.Reporting.getReport(Reporting.java:74)
     customer_care.servlet.Reporting.processRequest(Reporting.java:50)
     customer_care.servlet.Reporting.doGet(Reporting.java:89)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Here is the code:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        byte[] byte_array = null;
        try{
            File reportFile = new File(this.getServletConfig().getServletContext().getRealPath("/reports/torte_call_center_agenzie.jasper"));
            if (!reportFile.exists()) throw new JRRuntimeException("File jasper non trovato");
            String nomeFile = reportFile.getPath();
            Map parameters = new HashMap();
            parameters.put("codice_questionario", "2");   //just for testing
            ConnettitiAlDB c = new ConnettitiAlDB();
            Connection conn = c.Connettiti(Conf.db_principale);
            byte_array = JasperRunManager.runReportToPdf(fullpath_filename, parameters, connessione);
            conn.close();
        catch(JRException e){
            e.printStackTrace();
        catch(SQLException e) {
            e.printStackTrace();
        response.setContentType("application/pdf");
     response.setContentLength(byte_array.length);
     ServletOutputStream ouputStream = response.getOutputStream();
     ouputStream.write(byte_array, 0, byte_array.length);
     ouputStream.flush();
     ouputStream.close();
     }Any suggestion? That would be vital to me!
Thanks in advance

catching the JRRuntimeException and printing its stacktrace i saw that the jfree chart lib was missing.
i put it in my libraries but now i got this error:
java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfContentByte.transform(Ljava/awt/geom/AffineTransform;)V
     net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:1468)
     net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:484)
     net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:448)
     net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:413)
     net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:250)
     net.sf.jasperreports.engine.JasperExportManager.exportReportToPdf(JasperExportManager.java:188)
     net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:205)
     customer_care.servlet.Reporting.getReport(Reporting.java:77)
     customer_care.servlet.Reporting.processRequest(Reporting.java:50)
     customer_care.servlet.Reporting.doGet(Reporting.java:92)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.lowagie.text.pdf.PdfContentByte.transform is inside the iText library.
I had an old version so I updated it but nothing changed.
Any suggestion?
Thanks

Similar Messages

  • Datamerge problems with images in pdf export

    Hi
    Trying to set up a datamerge file to create multi page spread documents with fields on different pages. Attempting to set it up so it's as automated as possible as there are up to 20 different merge documents needing to merge with up to 100 different csv records from the same file each week .  The merge documents have different and repeated merge fields on most pages. 
    I've set it up so that the document has facing pages, and most pages have images spread across the whole of the spread.  the pages preview fine, they are created ok when using 'Create Merged Document' although the page numbers continue from one document to another (another problem).  but when I come to export to pdf, then the merge only shows the image on the left spread but on both left and right spread single pages, and the page numbers don't show the correct page numbers eg it will go p1 p2 p1 p2 etc all the way through the document instead of p1 p2 p3 - p20 etc.  I don't want to have to merge first then pdf but can't understand why the images and page numbers are not showing correctly.  Anyone shed some light on this please?
    Many thanks

    I have a simialar problem with the page numbers.  I dont know the proper solution to this, but since I only work with a few records the following works OK for me right now.
    What I do Is first set up for the data merge on the master page along with any object that have to be on every page.  Until it is merged I only make the master page.
    Then after it is merged I go and make any other edits to the individual pages. I dont know how to make it merge ONTO the pages you alread created.

  • Problem with Jasper Reports

    hi evrybody... i'm having a problem while using Jasper Reports. I'm trying to Export a jrxml file generated by JasperAssistant plug-in in eclipse. but all i'm having is an exception. the following is my code and the said exception:
    CODE:
    public class DataSourceApp
    private static final String TASK_HTML = "html";
    private static final String TASK_XLS = "xls";
    private static final String TASK_CSV = "csv";
    private static final String TASK_RUN = "run";
    public static void main(String[] args)
    String fileName = null;
    String taskName = null;
    taskName = "html";
    fileName = "path\\DataSourceReport.jasper";
    try
    long start = System.currentTimeMillis();
    if (TASK_HTML.equals(taskName))
    JasperPrint jPrint = new JasperPrint();
    HashMap parameters = new HashMap();
    Connection con = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:BOM_DSN","","");
    jPrint = JasperFillManager.fillReport("path\\DataSourceReport.jrxml", parameters, con);
    JasperExportManager.exportReportToHtmlFile(fileName);
    System.err.println("HTML creation time : " + (System.currentTimeMillis() - start));
    System.exit(0);
    catch (JRException e)
    e.printStackTrace();
    System.exit(1);
    catch (Exception e)
    e.printStackTrace();
    System.exit(1);
    EXCEPTION:
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
         at datasource.DataSourceApp.main(DataSourceApp.java:184)
    NESTED BY :
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
         at datasource.DataSourceApp.main(DataSourceApp.java:184)
    NESTED BY :
    net.sf.jasperreports.engine.JRException: Error loading object from file : C:\Eclipse\eclipse\workspace\test\BOM_Package\DataSourceReport.jrxml
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:89)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
         at datasource.DataSourceApp.main(DataSourceApp.java:184)
    Caused by: java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
         ... 2 more
    hope you can help me asap.. thanks!
    --joms                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    HI All
    I am working on Jasper report Project and when i am filling the report through
    JasperFillManager.fillreport(String sourceFileName,Map parameters,Connection conn)
    I am getting following exception:(I have included common-collections 3.2.jar in my classpath)
    java.lang.NoClassDefFoundError: org/apache/commons/collections/ReferenceMap
         at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.<clinit>(JRAbstractJavaCompiler.java:58)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:489)
         at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:243)
         at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:411)
         at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:418)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
         at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
         at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
    Please Suggest ;Thanks in advance

  • Date problem with jasper reports

    I need to pass the date values as a parameter to the jasper reports and process it in the report, how can achieve it please give me a brief explanation, i need the date value for processing a sql statement in the jasper report please help me a sample code
    from=first date value;
    to=second date value;
    //i need to pass the date  as the parameter how can i achieve it
          HashMap hm = new HashMap();
           hm.put("fromdate", from);
           hm.put("todate", to);
      JasperPrint jasperPrint;
                        jasperPrint = JasperFillManager.fillReport("W:/ReportWorks/Estimation Reports/Dailyreport ItemWise.jasper",hm, con);
                        JasperViewer.viewReport(jasperPrint,false); 

    HI All
    I am working on Jasper report Project and when i am filling the report through
    JasperFillManager.fillreport(String sourceFileName,Map parameters,Connection conn)
    I am getting following exception:(I have included common-collections 3.2.jar in my classpath)
    java.lang.NoClassDefFoundError: org/apache/commons/collections/ReferenceMap
         at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.<clinit>(JRAbstractJavaCompiler.java:58)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:489)
         at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:243)
         at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:411)
         at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:418)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
         at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
         at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
    Please Suggest ;Thanks in advance

  • Trying to generate a pdf with jasper reports

    Fellas,
    i hav trying to generate a pdf with jasper reports, but i cant. I create a file .jasper with iReports. This is my code:
    emite.java
    package utilitarios;
    //import net.sf.jasperreports
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.view.JasperViewer;
    import java.sql.*;
    import java.util.*;
    import javax.swing.*;
    import java.util.HashMap;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class emitebl {
    private static Connection getConnection( ) throws ClassNotFoundException, SQLException{
    String driver = "org.postgresql.Driver";
    String url = "jdbc:postgresql://localhost/sist";
    String user = "usuario";
    String password = "";
    Class.forName(driver);
    Connection con = DriverManager.getConnection( url, user, password );
    return con;
    public void geraRelatorio( ) throws JRException, Exception{
    Connection con = getConnection( );
    Statement stm = con.createStatement( );
    String query = "SELECT * FROM emissaobl WHERE id=4";
    ResultSet rs = stm.executeQuery(query);
    JRResultSetDataSource jrRS = new JRResultSetDataSource(rs);
    Map parameters = new HashMap();
    JasperFillManager.fillReportToFile("emitebl.jasper",parameters,jrRS);
    JasperExportManager.exportReportToPdfFile("emitebl.jrprint");
    JasperViewer.viewReport("emissao_bl.pdf",false);
    } emissao.jsp:
    <%@ page import="utilitarios.*" %>
    <%
    new emitebl().geraRelatorio();
    %>Following the error message exception:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: emitebl.jasper
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
         org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:76)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    root cause
    net.sf.jasperreports.engine.JRException: emitebl.jasper
         net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:73)
         net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:270)
         utilitarios.emitebl.geraRelatorio(emitebl.java:37)
         org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:54)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)where i hav to put the .jasper file?

    Hi,
    If you have placed your .jrxml file say in C:\reports, and when you use compileReportToFile(jrxmlFileName), then the jasper file will be created in the same directory C:\report with the same file name with .jasper extension. If you want a pdf report then specify the same location and file name with '.pdf' extension as destination .
    Hope this helps

  • Problems with a report generated as PDF

    I am having a problem with my report when it is generated as a PDF file from the reports server. A space is added soon after the letter w in all the words where there is letter w; for example, the word awake appears as aw ke, will appears as w ill, etc. Does anyone know how to fix this problem? I am using Reports 11g. Thanks.

    Hi
    In layout change the font (Redo font) thru menu option (Not Font) Format -> Font >Western.
    This may solve your problem...
    user8655468 wrote:
    I am having a problem with my report when it is generated as a PDF file from the reports server. A space is added soon after the letter w in all the words where there is letter w; for example, the word awake appears as aw ke, will appears as w ill, etc. Does anyone know how to fix this problem? I am using Reports 11g. Thanks.

  • Problem with printing a PDF

    Hi All,
    I'm developing a web application written in J2EE that uses Java Reporting Component (JRC) to display crystal reports from some filters recovered from a jsp and passed to a report .rpt previously designed and invoked just at runtime.
    I have a problem with printing a PDF:
    I want, after entering the filters in a jsp, to print a report in PDF format (WORD) without opening it
    with Adobe Reader (Microsoft Word). The class of API JRC used for export is ReportExportControl.
    Can anyone help me?
    I wish a great day to You all.

    Hi Ted Ueda,
    sorry for the delay of my answer.
    I understand very well the problems related to security.
    With the following code that I used to produce a report (PDF) at runtime,
    is the PDF created on the server and then sent to the client, or is it directly created on the client as PDF
    from RTF previously realized?
    ReportExportControl exportControl = new ReportExportControl();
    String report = report path;
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open(report, OpenReportOptions._openAsReadOnly);
    Object reportSource = null;
    reportSource = reportClientDoc.getReportSource();
    //The method setConnectionProperties() stores all the connection parameters in the collection
    //ConnectioInfos
    ConnectionInfos connInfos = setConnectionProperties(request, reportClientDoc);
    exportControl.setEnableLogonPrompt(false);
    exportControl.setEnableParameterPrompt(false);
    exportControl.setReportSource(reportSource);
    exportControl.setDatabaseLogonInfos(connInfos);
    //Single method to pass parameters to Crystal Reports. Using classes ParameterFieldController and
    //ParameterFieldDiscreteValue
    setReportParametersValue(reportClientDoc, reportParameters, subReportParameters);
    ExportOptions exportOptions = new ExportOptions();
    //Set the export format (PDF)
    exportOptions.setExportFormatType(ReportExportFormat.PDF);
    PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
    exportOptions.setFormatOptions(PDFExpOpts);
    exportControl.setExportOptions(exportOptions);
    exportControl.setExportAsAttachment(true);
    try {
          exportControl.getHtmlContent(request, response, getServletConfig().getServletContext());
    } catch (ReportSDKExceptionBase e) {
    throw new ApplicationException("error code", ": error message"); }               
    As, however, I predicted in my previous message about the direct printing on the client,
    I read about ActiveX, but I don't know how to use them.
    I read this information in the 'Crystal Reports for Eclipse Developer Guide' about "printMode" attribute:
    "In ActiveX print mode, an ActiveX control is downloaded to the client machine and the report is send directly to the printer...."
    The ActiveX alternative is a java applet that runs on the client and takes the pdf from the server and prints directly onto the clients through the commands that I used in the DOS command line:
    1)     AcroRd32.exe /p /h FILENAME
    where
    /p = print
    /h = hide window
    to print the report and
    2)     tkill AcroRd32
    to close Adobe Reader, because it doesn't end automatically after printing and the command  /h  is used just to minimize the process.
    I hope you can give me advice because I need to print directly on the client. Thank you

  • Report viewer "Go To Next Page" button always load Page2 with Crystal Reports Runtime version 10.0.10. No problem with Crystal Reports Runtime version 10.0.5

    Report viewer "Go To Next Page" button always load Page2 with Crystal Reports Runtime version 10.0.10. No problem with Crystal Reports Runtime version 10.0.5.
    NOTE: I did not check other Crystal Runtime versions.
    Any solution?

    Visual Studio Premium 2012.
    It is a web application.
    It was working fine with Crystal Report version 13.0.5. Only change is uninstall Crystal Report version 13.0.5 and install Crystal Report version 13.0.10
    Entering page number works fine to view that page Request.Form parameters sample for that (change page from page 3 to page 5):
    __CRYSTALSTATEviewer:{"0":{"rptViewLabel":"Ana Rapor", "gpTreeCurrentExpandedPaths":{}, "vCtxt":"/wEXAwUVSXNMYXN0UGFnZU51bWJlcktub3duZwUOTGFzdFBhZ2VOdW1iZXICBQUKUGFnZU51bWJlcgIC", "pageNum":2}, "common":{"width":"100%", "Height":"100%", "enableDrillDown":true, "drillDownTarget":"_self", "printMode":"Pdf", "displayToolbar":true, "pageToTreeRatio":6, "pdfOCP":true, "promptingType":"html", "viewerState":"/wEXBAUkU3lzdGVtLldlYi5VSS5XZWJDb250cm9scy5XZWJDb250cm9sDxYGHgVXaWR0aBsAAAAAAABZQAcAAAAeBkhlaWdodBsAAAAAAABZQAcAAAAeBF8hU0ICgANkBQJodAUGX2JsYW5rBQ9SZXBvcnRWaWV3U3RhdGUXCAUDZHBpAngFB0lMT0lVSVNoBQdGYWN0b3J5BZYBQ3J5c3RhbERlY2lzaW9ucy5SZXBvcnRTb3VyY2UuUmVwb3J0U291cmNlRmFjdG9yeSxDcnlzdGFsRGVjaXNpb25zLlJlcG9ydFNvdXJjZSwgVmVyc2lvbj0xMy4wLjIwMDAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj02OTJmYmVhNTUyMWUxMzA0BQlSZXBvcnRVUkkFSkQ6XFBSSi5ORVRcV2ViUmVwb3J0czIwXFdlYlJlcG9ydHMuREFMXFJlcG9ydHNcVzJfNDMzN19SRVNfQllfQ1JFQVRJT04ucnB0BQpEZXNpZ25Nb2RlaAUHUmVmcmVzaGgFElBhZ2VSZXF1ZXN0Q29udGV4dBcEBRVJc0xhc3RQYWdlTnVtYmVyS25vd25nBQ5MYXN0UGFnZU51bWJlcgIFBQpQYWdlTnVtYmVyAgIFFEludGVyYWN0aXZlU29ydEluZm9zFClYU3lzdGVtLkJ5dGUsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OY0BAzwDPwN4A20DbAMgA3YDZQNyA3MDaQNvA24DPQMiAzEDLgMwAyIDPwM+Aw0DCgM8A0EDcgNyA2EDeQNPA2YDUwNvA3IDdANJA24DZgNvAyADeANtA2wDbgNzAzoDeANzA2kDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMtA2kDbgNzA3QDYQNuA2MDZQMiAyADeANtA2wDbgNzAzoDeANzA2QDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMiAyADLwM+BQlScHRTb3VyY2UFN0NyeXN0YWxEZWNpc2lvbnMuUmVwb3J0U291cmNlLk5vbkhUVFBDYWNoZWRSZXBvcnRTb3VyY2UFA2Nzc2U=", "rptAlbumOrder":["0"], "toolPanelType":"GroupTree", "toolPanelWidth":200, "toolPanelWidthUnit":"px", "iactParams":[{"paramName":"pFromDate", "description":"From Date", "valueDataType":"d", "value":[{"d":9, "m":4, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pToDate", "description":"To Date", "valueDataType":"d", "value":[{"d":9, "m":6, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pGroupBy", "description":"Group by", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pDistributionBy", "description":"Distribution by", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"RN"}, {"value":2, "desc":"ARR"}], "defaultDisplayType":1}, {"paramName":"pShowDetails", "description":"Show details", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pSubGroupBy", "description":"Sub Group", "valueDataType":"n", "value":[-1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pIncludeDayUse", "description":"Include Day Use", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pDateType", "description":"Date Type", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pCompHuse", "description":"Comp-Huse", "valueDataType":"n", "value":[0, 1, 2], "allowCustomValue":true, "allowMultiValue":true, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pOrderBy", "description":"Order By", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}], "paramOpts":{"numberFormat":{"groupSeperator":".", "decimalSeperator":","}, "dateFormat":"d.M.yyyy", "timeFormat":"H:mm:ss", "dateTimeFormat":"d.M.yyyy H:mm:ss", "booleanFormat":{"true":"True", "false":"False"}, "maxNumParameterDefaultValues":"200", "canOpenAdvancedDialog":true}, "zoom":100, "zoomFromUI":false, "lastRefresh":"9.7.2014 17:47:04"}, "curViewId":"0"}
    viewer_toptoolbar_search_textField:Bul...
    text_viewer_toptoolbar_selectPg:5
    text_viewer_toptoolbar_zoom:100%
    __CALLBACKID:viewer
    __CALLBACKPARAM:{"tb":"gototext", "text":"5"}
    Try to view New Page does not work. Request.Form parameters sample for that (try change page from page 2 to page 3):
    __CRYSTALSTATEviewer:{"0":{"rptViewLabel":"Ana Rapor", "gpTreeCurrentExpandedPaths":{}, "vCtxt":"/wEXAwUVSXNMYXN0UGFnZU51bWJlcktub3duZwUOTGFzdFBhZ2VOdW1iZXICBQUKUGFnZU51bWJlcgIC", "pageNum":2}, "common":{"width":"100%", "Height":"100%", "enableDrillDown":true, "drillDownTarget":"_self", "printMode":"Pdf", "displayToolbar":true, "pageToTreeRatio":6, "pdfOCP":true, "promptingType":"html", "viewerState":"/wEXBAUkU3lzdGVtLldlYi5VSS5XZWJDb250cm9scy5XZWJDb250cm9sDxYGHgVXaWR0aBsAAAAAAABZQAcAAAAeBkhlaWdodBsAAAAAAABZQAcAAAAeBF8hU0ICgANkBQJodAUGX2JsYW5rBQ9SZXBvcnRWaWV3U3RhdGUXCAUDZHBpAngFB0lMT0lVSVNoBQdGYWN0b3J5BZYBQ3J5c3RhbERlY2lzaW9ucy5SZXBvcnRTb3VyY2UuUmVwb3J0U291cmNlRmFjdG9yeSxDcnlzdGFsRGVjaXNpb25zLlJlcG9ydFNvdXJjZSwgVmVyc2lvbj0xMy4wLjIwMDAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj02OTJmYmVhNTUyMWUxMzA0BQlSZXBvcnRVUkkFSkQ6XFBSSi5ORVRcV2ViUmVwb3J0czIwXFdlYlJlcG9ydHMuREFMXFJlcG9ydHNcVzJfNDMzN19SRVNfQllfQ1JFQVRJT04ucnB0BQpEZXNpZ25Nb2RlaAUHUmVmcmVzaGgFElBhZ2VSZXF1ZXN0Q29udGV4dBcEBRVJc0xhc3RQYWdlTnVtYmVyS25vd25nBQ5MYXN0UGFnZU51bWJlcgIFBQpQYWdlTnVtYmVyAgIFFEludGVyYWN0aXZlU29ydEluZm9zFClYU3lzdGVtLkJ5dGUsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OY0BAzwDPwN4A20DbAMgA3YDZQNyA3MDaQNvA24DPQMiAzEDLgMwAyIDPwM+Aw0DCgM8A0EDcgNyA2EDeQNPA2YDUwNvA3IDdANJA24DZgNvAyADeANtA2wDbgNzAzoDeANzA2kDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMtA2kDbgNzA3QDYQNuA2MDZQMiAyADeANtA2wDbgNzAzoDeANzA2QDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMiAyADLwM+BQlScHRTb3VyY2UFN0NyeXN0YWxEZWNpc2lvbnMuUmVwb3J0U291cmNlLk5vbkhUVFBDYWNoZWRSZXBvcnRTb3VyY2UFA2Nzc2U=", "rptAlbumOrder":["0"], "toolPanelType":"GroupTree", "toolPanelWidth":200, "toolPanelWidthUnit":"px", "iactParams":[{"paramName":"pFromDate", "description":"From Date", "valueDataType":"d", "value":[{"d":9, "m":4, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pToDate", "description":"To Date", "valueDataType":"d", "value":[{"d":9, "m":6, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pGroupBy", "description":"Group by", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pDistributionBy", "description":"Distribution by", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"RN"}, {"value":2, "desc":"ARR"}], "defaultDisplayType":1}, {"paramName":"pShowDetails", "description":"Show details", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pSubGroupBy", "description":"Sub Group", "valueDataType":"n", "value":[-1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pIncludeDayUse", "description":"Include Day Use", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pDateType", "description":"Date Type", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pCompHuse", "description":"Comp-Huse", "valueDataType":"n", "value":[0, 1, 2], "allowCustomValue":true, "allowMultiValue":true, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pOrderBy", "description":"Order By", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}], "paramOpts":{"numberFormat":{"groupSeperator":".", "decimalSeperator":","}, "dateFormat":"d.M.yyyy", "timeFormat":"H:mm:ss", "dateTimeFormat":"d.M.yyyy H:mm:ss", "booleanFormat":{"true":"True", "false":"False"}, "maxNumParameterDefaultValues":"200", "canOpenAdvancedDialog":true}, "zoom":100, "zoomFromUI":false, "lastRefresh":"9.7.2014 17:47:04"}, "curViewId":"0"}
    viewer_toptoolbar_search_textField:Bul...
    text_viewer_toptoolbar_selectPg:2 / 5
    text_viewer_toptoolbar_zoom:100%
    __CALLBACKID:viewer
    __CALLBACKPARAM:{"tb":"next"}

  • JSF with Jasper Reports

    Hi,
    I am a new bie to JSF and also Jasper Reports.
    I Have created a JSF page where by passing fromDate and toDate from UI passed as a parameter to Jasperreport to generate a report.
    Report is generated as a pdf but my requirement is i want to view the pdf in the browser.
    I used with runReportToPdf(), but with this i dont no how to get the servletConfig whereby in some code i got the code to get the servletConfig and servletContext and passing the .jasper file to convert it as a inputStream or a File.
    I think this is not the proper way to view the things in browser bcoz i want to show the Excel and CSV report also in the browser.
    Could anyone Pls help me in this. Is there any other way to do this.
    My Code:
    <code>
    public void execute()
         try
              FacesContext context = FacesContext.getCurrentInstance();
              Object ObjTest = context.getExternalContext().getSessionMap().get("awardCodeMast");
              AwardCodeMast aObj = (AwardCodeMast)ObjTest;
                        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                        Date fromDate1 = aObj.getEffectiveFromDate();
                        String s1 = df.format(fromDate1);
                        System.out.println("#####################"+s1);
              Date toDate1 = aObj.getEffectiveToDate();
              String s2 = df.format(toDate1);
              System.out.println("#####################"+s2);
                        // Started with Jasper Reports
              JasperReport jasperReport;
              JasperPrint jasperPrint;
              JRResultSetDataSource obj;
              JasperDesign jasperDesign;
              JRDataSource jr1;
              String fromDate = s1;
              String toDate = s2;
              Class.forName("com.mysql.jdbc.Driver");
              Connection con1=DriverManager.getConnection("jdbc:mysql://HARUNS-ATHITHI.ITCINFOTECH.COM/pba","root","root");
              Statement stmt1=con1.createStatement();
              Map<String, Serializable> parameters = new HashMap<String, Serializable>();
              parameters.put("fromDate", fromDate);
              parameters.put("toDate", toDate);
              System.out.println("Put...........");
              String ss = context.getExternalContext().getRequestServletPath();
              System.out.println("SS : "+ss+"...............");
              byte[] bytes = null;
              ServletOutputStream outstream = null;
              InputStream reportStream = context.getExternalContext().getResourceAsStream("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jasper");
              HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
              outstream = response.getOutputStream();     
              ExternalContext extContext = context.getExternalContext();
              ServletContext servletContext = (ServletContext) extContext.getContext();
              File reportFile = new File("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jasper");
              jasperDesign = JasperManager.loadXmlDesign("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jrxml");
         System.out.println("1..................");
         jasperReport = JasperCompileManager.compileReport(jasperDesign);
         System.out.println("2...................");     
         JasperRunManager.runReportToPdfStream(reportStream, outstream, parameters, con1);
         jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, con1);
         System.out.println("3...............");
         String ss1 = (String)context.getExternalContext().getRequestPathInfo();
         System.out.println(ss1+"............................");
         System.out.println("Report generated....................");
         response.setContentType("application/pdf");
         response.setContentLength(bytes.length);
         System.out.println("Setting content type..................");
         System.out.println("getting output Stream...........");
         response.setContentLength(bytes.length);
         System.out.println("setting the context length...........");
         JasperRunManager.runReportToPdfStream(reportStream, outstream,parameters, con1);
         //outstream.write(bytes);
         System.out.println("writing byte array.............");
         outstream.flush();
         System.out.println("flushing out..............");
         outstream.close();
         ret_sta = "Success";
         }catch(Exception e){System.out.println(e);}
         System.out.println(ret_sta+".....................");
         FacesContext context = FacesContext.getCurrentInstance();
    context.responseComplete();
    </code>
    Kindly help me, i would be very thankful to u.
    Thanks,
    Ambika.

    Hi,
    I want to display a pdf through a web browser. I got it to work with my one report but my other one do not want to work.
    Here is my code.
    public void executeShiftReport(Calendar dateOfReport) {
    try {
    Calendar calMrng = new GregorianCalendar(dateOfReport.get(Calendar.YEAR), dateOfReport.get(Calendar.MONTH), dateOfReport.get(Calendar.DAY_OF_MONTH), 06, 00);
    Date reportDate = dateOfReport.getTime();
    Date dateMrng = calMrng.getTime();
    JasperPrint jasperPrint;
    Connection conn = establishConnection();
    //the paramaters of the report will be saved within the hashmap
    HashMap jasParam = new HashMap();
    jasParam.put("fromDateMorning", new Timestamp(dateMrng.getTime()));
    jasParam.put("Date", reportDate);
    // adds 1 day to the calender to get tomorrows date for night shift ending
    calMrng.add(Calendar.DAY_OF_MONTH, 1);
    Date dateMoreMrng = calMrng.getTime();
    jasParam.put("toDateMorning", new Timestamp(dateMoreMrng.getTime()));
    File file = new File("E:/Projects/BranSystems Internal/BranSupportLog/reports/");
    jasperPrint = JasperFillManager.fillReport(new FileInputStream(new File(file, "morningShift.jasper")), jasParam, conn);
    // JasperExportManager.exportReportToPdf(jasperPrint);
    // JasperExportManager.exportReportToHtmlFile(jasperPrint, "E:/Projects/BranSystems Internal/BranSupportLog/reports/morningShift.html");
    byte[] bytes = JasperExportManager.exportReportToPdf(jasperPrint);
    FacesContext context = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
    // let the pdf display in the same window with 'inline',
    response.setHeader("Content-disposition", "inline;filename=morningShift.pdf;");
    response.setContentType("application/pdf");
    response.setContentLength(bytes.length);
    response.getOutputStream().write(bytes);
    response.flushBuffer();
    context.responseComplete();
    } catch (JRException ex) {
    Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
    Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
    Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
    }

  • Edition with jasper report

    I want to edit with jasper report so I have this 2 classes.In the first I have this method
    private Map parameters;
    public void addParametre(String nom, Object valeur)
    if(parameters == null)
    parameters = new HashMap();
    parameters.put(nom, valeur);
    and the second class I have this method
    public String editionAction() {
    ReportGeneratorImmat ge =new ReportGeneratorImmat((String)getForRep().getValue()) ;
    String pWhere="matr='145-A' and";
    String pOrder="order by nom";
    ge.addParametre("P_WHERE",pWhere);
    ge.addParametre("P_ORDER",pOrder);
    return null;
    the problem is that the first parametre (P_WHERE) is successfully added but the the second (P_Order) no. So how can I add both?

    Seems that this question would be better asked on the Jasper Report forums, no?
    John

  • Problem with saving a pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21).

    Need advice on a saving file issue. I'm having problem with saving a .pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21). This is new as this error message just recently started to pop-up.

    More information about this issue can be found here:
    https://forums.adobe.com/thread/1672655
    A "quick" fix that worked for me was to uninstall Adobe... then download the base install for Adobe Reader 11.0.
    Then download each of the individual updates and run them sequentially. 
    I've installed back up to the last security update which is version 08 and have been able to do normal Save As operations.
    You will have to disable automatic updates in order to stay at version 08 until Adobe resolves this issue in a later release.
    http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows
    Adobe Reader 11.0 - Multilingual (MUI) installer    AdbeRdr11000_mui_Std
    Adobe Reader 11.0.01 update - Multilingual (MUI) installer    AdbeRdrUpd11001_MUI.msp
    Adobe Reader 11.0.02 update - All languages    AdbeRdrSecUpd11002.msp
    Adobe Reader 11.0.03 update - Multilingual (MUI) installer    AdbeRdrUpd11003_MUI.msp
    Adobe Reader 11.0.04 update - Multilingual (MUI) installer    AdbeRdrUpd11004_MUI.msp
    Adobe Reader 11.0.05 security update - All languages    AdbeRdrSecUpd11005.msp
    Adobe Reader 11.0.06 update - Multilingual (MUI) installer    AdbeRdrUpd11006_MUI.msp
    Adobe Reader 11.0.07 update - Multilingual (MUI) installer    AdbeRdrUpd11007_MUI.msp
    Adobe Reader 11.0.08 security update - All languages    AdbeRdrSecUpd11008.msp

  • Problem with viewing Adobe PDF documents

    Problem with viewing Adobe PDF documents
    I have a Windows 7 Home Premium Computer
    I have read all the suggestions and I have tried downloading multiple versions of Adobe Reader for Windows 7 and Vista from http://get.adobe.com/reader/otherversions/.
    Prior to downloading each version I would delete the current version using  control panel programs uninstall.
    After each new installation I would shut down the computer and then restart the computer.
    I have tried downloading versions with and without having my antivirus (CA Total Defence) running.
    I am told after download that the version downloaded successfully.
    I have read Acrobat Help http://helpx.adobe.com/acrobat/kb/troubleshoot-reader-installation-windows.html and followed the instructions.
    None of the above has helped.
    The problem is no matter what version of Adobe Reader I download, I cannot seem to open a PDF and read it. Nor will the Reader itself stay open.
    1. If I try opening the reader from the desktop link or from the actual program menu, the reader opens for about 5 seconds and then closes of its own accord. If I try to click on any of the reader menus (eg File, Edit, View, Window, Help, Tools) then a warning bell is sounded and the menu does not open. Shortly thereafter the reader closes.
    2. If I try to open the reader by double clicking on a PDF document then the reader opens but the document is not shown (only the grey PDF reader screen is shown) and then the reader closes after about 5 seconds of its own accord.
    The desktop shortcut shows as the 'red Adobe Reader icon'. But the actual program menu icon shows as a blank folder icon.  All PDF documents show as the PDF Adobe icon.
    I have tested various PDFs and none will open on this computer but they will open on other computers.
    I have created a word document and saved it as a PDF. It looked like it had save correctly (has the appropriate icon) but when I try to open it as per step 2 above then the document is not shown and then the reader closes after about 5 seconds of its own accord.
    Does anyone have any ideas about what is going on and how I can fix this?
    Could you please answer in this forum and email me at [removed]
    I am so puzzled and frustrated.

    Thank you so much this did the trick.
    I spent so many hours on trying to sort this out and your answer was so  simple and clear.
    Regards
    Kazzamday

  • Problem with opening of PDF in my webmail application

    I have a problem with opening a pdf file in my webmail application of my internet provider in apple safari since yesterday. When I wanted to open up a pdf file I got a pop up message to allow a connection between adobe and the webmail application which I did. Since then I can not open up a pdf file. If I go to another browser or if I use email from another internet provider I use too it works and I can open up. It seems to be a blockage of the specific combination of this webmail application and safari.
    What can I do ?

    Hi,
    I have same requirement.
    I need to cnvert smartform->pdf->send mail.
    The mail is send but the attachment is corrupted.
    Can you tell me what code you have written so its working in developement?

  • Problems with filling out PDF forms

    We have problems with filling out PDF-forms. Aotomatic filling of forms is deactivated and we use the Adobe Reader 11.0.05. The problem is: After some time the inputs are wrong put down in the form. For example: I write 120 and in the form stands 125. We have already extinguished the cache. Thanks for your help in advance.

    You will get that first message when the document has been changed in a way that invalidates the internal digital signature that's applied when a document is Reader-enabled. Certain changes are allowed (e.g., filling fields, commenting, signing) and will not invalidate the signature, but others are not. The exact cause of the change is often hard to track down, but it can be due to font problems, some type of file corruption, or something that Acrobat/Reader attempts to correct when the file is opened/saved. You will also get the message if the users system time is not correct and is currently set to some time before the document was Reader-enabled. It seems best to use the most recent version of Acrobat to enabled the documents and recent versions of Reader to work with them.
    It problem is probably not related to the user using anything in the Sign pane.

  • Is there a bug or problem with increased noise when exporting pictures out of Lightroom 4?

    Is there a bug or problem with increased noise when exporting pictures out of Lightroom 4?

    As you are asking about it, looks like you do see a problem. So if googling does not provide a solution, you should describe the issue in detail so we can try to help out.

Maybe you are looking for