Jump to content
Changes to the Jaspersoft community edition download ×

How to display PDF reports in browser


Recommended Posts

By: Azhar Azim - azharazim

How to display PDF reports in browser

2003-09-10 22:51

Hi

I want to display a report generated in PDF format in my browser window, without saving the file to disk. How can i do this. Need help.

thanx

azhar

 

 

 

 

By: peter bosmans - petbos

RE: How to display PDF reports in browser

2003-09-10 23:57

Yesterday i saw the next snip example. Maybe this give you a hint. Let me know your result. I will try it also.

 

<%@ page language="java" %>

<%@ page import="dori.jasper.engine.*" %>

<%@ page import="java.util.*" %>

<%@ page import="java.io.*" %>

<%@ page import="java.sql.*" %>

<%

 

DriverManager.registerDriver(new oracle.jdbc.OracleDriver());

String url = "some-url";

String userName = "username";

String password = "password";

 

Connection conn = DriverManager.getConnection (url, userName, password);

 

File reportFile = new File(application.getRealPath("/reports/Demo.jasper"));

 

Map parameters = new HashMap();

 

byte[] bytes =

JasperRunManager.runReportToPdf(

reportFile.getPath(),

parameters,

conn

);

 

 

response.setContentLength(bytes.length);

ServletOutputStream ouputStream = response.getOutputStream();

ouputStream.write(bytes, 0, bytes.length);

ouputStream.flush();

ouputStream.close();

 

%>

 

 

 

 

 

By: Teodor Danciu - teodord

RE: How to display PDF reports in browser

2003-09-28 04:07

 

Hi,

 

Check the provided "webapp" sample.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...