Jump to content

kayroc

Members
  • Posts

    5
  • Joined

  • Last visited

kayroc's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hello; I am new to JasperReports. I am able to crate pdf and see using JasperViewer, unfortunately, it is not rendering in pdf in Firefox; it just displays bytes. (It starts with %PDF-1.4 and ends with %%EOF.) Here is my environment info: - JasperReports 4.0.2 - Seam 2.2 - Weblogic 11g - Firefox 4.0 BTW, the same code works with straight JSP and Tomcat. Unfortunately, it does not work in Weblogic :( Any ideas? Thanks in advance. Ekrem Code: Code:Here is output:%PDF-1.4 %���� 3 0 obj <>stream x���MS�0���{� 1�i�uG<�Ճ�ã¡ï¿½ï¿½ï¿½#�{7�-X;�d�d�;ϾI�AN"" �@����}�� �æŸï¿½ï¿½q� �وt��¬�Ta7��d�����'dTJ�`8.'l`����R��(� �u.�ia�y%�W�e{|�1.h�QRS&PKQe��i�q ���0��g�� ��YZ�������aL�C��+�k��QǸ3P¬�ػ'-k�����R�*X!����X'<��Md�6�)�Z��]=��[_|�X��ƭ<�z5o�vB�E���/k�����I�f��������k��|� ���r{�Q ��l�V� � �MF��R{.�vb�XP�ӯ� Uu�ﻳ����g���ߺ�<�Og��£.j endstream endobj 1 0 obj <>/Parent 4 0 R/Contents 3 0 R/Type/Page/Resources<>/Font<>>>/MediaBox[0 0 595 842]>> endobj 5 0 obj [1 0 R/XYZ 0 854 0] endobj 2 0 obj <> endobj 4 0 obj <> endobj 6 0 obj <> endobj 7 0 obj <> endobj 8 0 obj <>/Pages 4 0 R>> endobj 9 0 obj <> endobj xref 0 10 0000000000 65535 f 0000000480 00000 n 0000000749 00000 n 0000000015 00000 n 0000000837 00000 n 0000000714 00000 n 0000000900 00000 n 0000000954 00000 n 0000000986 00000 n 0000001089 00000 n trailer <<8246801d0f7890c8c30acac4619aceae>]/Info 9 0 R/Size 10>> startxref 1249 %%EOF Post Edited by kayroc at 08/12/2011 11:59
  2. Hi, I would like to get the report parameters passed by user; is it possible? (I know that JasperReport has getParameters() and returns JRParameter[] that inludes 17 JRparameter plus user parameters. I can find the passed user parameters from there but I wonder if there is any function that gives what I am looking for) Thanks, Ekrem
  3. Hello Sanda; You can see my code. I am setting the ContentType "application/pdf" but I am getting the same error. The same code works with straight JSP and Tomcat. Unfortunately, it does not work in Weblogic :( Here is my environment info: - JasperReports 4.0.2 - Seam 2.2 - Weblogic 11g - Firefox 4.0 Thanks, Ekrem Code:Here is my code:public void createReport(String reportName, Map parameters){ FacesContext context = FacesContext.getCurrentInstance(); InputStream inputStream = null; Connection con = this.getHibernateSession().connection(); try { inputStream = this.getClass().getResourceAsStream("/" + reportName + ".jasper"); HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse(); ServletOutputStream outputStream = response.getOutputStream(); JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, parameters, con);// JasperViewer.viewReport(jasperPrint, true); byte[] pdfReport = JasperExportManager.exportReportToPdf(jasperPrint); response.setContentType("application/pdf"); response.addHeader("Content-Disposition", "attachment;filename=report.pdf"); response.setContentLength(pdfReport.length); outputStream.write(pdfReport); outputStream.flush(); outputStream.close(); context.responseComplete(); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { try { con.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }}
  4. I am getting the simmilar error message; have you solved this issue? I post this following message regarding my issue but so far nobody answered :( http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=90468 Thanks, Ekrem
  5. Hello; I am new to JasperReports. I am able to crate pdf and see using JasperViewer, unfortunately, it is not rendering in pdf in Firefox; it just displays bytes. (It starts with %PDF-1.4 and ends with %%EOF.) Here is my environment info: - JasperReports 4.0.2 - Seam 2.2 - Weblogic 11g - Firefox 4.0 Any ideas? Thanks in advance. Ekrem Code:Here is my code:public void createReport(String reportName, Map parameters){ FacesContext context = FacesContext.getCurrentInstance(); InputStream inputStream = null; Connection con = this.getHibernateSession().connection(); try { inputStream = this.getClass().getResourceAsStream("/" + reportName + ".jasper"); HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse(); ServletOutputStream outputStream = response.getOutputStream(); JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, parameters, con);// JasperViewer.viewReport(jasperPrint, true); byte[] pdfReport = JasperExportManager.exportReportToPdf(jasperPrint); response.setContentType("application/pdf"); response.addHeader("Content-Disposition", "attachment;filename=report.pdf"); response.setContentLength(pdfReport.length); outputStream.write(pdfReport); outputStream.flush(); outputStream.close(); context.responseComplete(); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { try { con.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }}
×
×
  • Create New...