Jump to content
We've recently updated our Privacy Statement, available here ×

sachinmdev

Members
  • Posts

    4
  • Joined

  • Last visited

sachinmdev's Achievements

Newbie

Newbie (1/14)

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

Recent Badges

0

Reputation

  1. Hi lucianc, Thankyou very much. I have set the content length as in the following example and it now works in IE 6.0 also. http://www.ensode.net/jasperreports_pdf_send_to_browser.html Cheers:laugh:
  2. I have checked JasperReports 2.0.5 in IE 7. Its working. It doesn't open the PDF in browser,instead it opens a prompt. I think this is the behavior of IE. You have to save the file to .pdf format to view the file. Otherwise it will be saved in default format only.B)
  3. Hi, I got the same output with your code also. I am using IE 6.0. I concluded the problem with IE only(Is it a bug?). Then Mozilla comes to my mind. I have checked it in mozilla. Both of our code works fine in Mozilla Firefox 2.0.0.12. So what is the compatible version of IE for JasperReports 2.0.5? :)
  4. I am using JasperReports 2.0.5,Eclipse 3.3.2 and Tomcat 5.0.28. I have wrote a java class to compile the jrxml and i got two files namely .jasper and .jrprint. Then I am using servlet to get the .jasper file and i have to display the pdf file in browser. But iam getting some string values in the browser. PDF is not displayed. Please help me to solve this problem. My Servlet Code: Code:public class DemoReport extends HttpServlet implements Servlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletOutputStream outputStream = response.getOutputStream(); InputStream inputStream = getServletConfig().getServletContext().getResourceAsStream("/reports/FirstReport.jasper"«»); try { JasperRunManager.runReportToPdfStream(inputStream, outputStream, new HashMap(), new JREmptyDataSource()); response.setContentType("application/pdf"«»); outputStream.flush(); outputStream.close(); } catch (JRException e) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); response.setContentType("text/plain"«»); response.getOutputStream().print(stringWriter.toString()); } } } Iam getting this output only in browser. It seems to be the stream is not converted properly. Code:[code]%PDF-1.4 %â£ÓŠ3 0 obj <>stream x?3R𢲊Ე0Biab??˥令`d?qih?dq?"+1PHÎ…Ö¤Ô¥`?g?ШҨ?.Jç’ˆpqSp.JM,IMQ.MNN-.N+͉?Tm???Ÿè˜?Â¥tÌž#? endstream endobj 1 0 obj<>>>/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<> endobj 9 0 obj<> endobj xref 0 10 0000000000 65535 f 0000000193 00000 n 0000000383 00000 n 0000000015 00000 n 0000000470 00000 n 0000000349 00000 n 0000000520 00000 n 0000000573 00000 n 0000000604 00000 n 0000000660 00000 n trailer <<6d225505f23facc80519044bb35bb78d>]/Root 8 0 R/Size 10/Info 9 0 R>> startxref 854 %%EOF
×
×
  • Create New...