Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem opening crystal report in PDF using Adobe 6.0

Status
Not open for further replies.

JenCR

Programmer
Aug 1, 2005
3
US
Hi,
I am having problem opening a crystal report in PDF format within a browser without embedding the id and password in the URL. I tried using the following logic, and I was able to removed id/pwd info from URL in Adobe 7.0, but in Adobe 6.0 the report just doesnot open. Our client is not open to upgrade to Adobe 7.0. Any ideas/suggestions?

Thanks,
Jennifer.

FYI: Using Crystal server 9.0 on Win 2000 machine. Application(J2EE) on WEbsphere 5.1.1.5 server.

Following Logic(Does remove info in URL in Adobe 7.0, but breaks in 6.0):
OutputStream os = null;

try
{

CrystalServices cs = CrystalServices.getInstance();

String url = cs.getReportUrl(state, reportInfo, reportFormat, param);

URL urlcon = new URL(url);
URLConnection conn = urlcon.openConnection();

conn.connect();

InputStream is = conn.getInputStream();

int length = 0;
length = conn.getContentLength();

if((reportFormat == CIS_REPORT_FORMAT_EXCELSTD) || (reportFormat == CIS_REPORT_FORMAT_EXCELEXT) )
{
httpRpse.setContentType("application/vnd.ms-excel");
}
else if((reportFormat == CIS_REPORT_FORMAT_PDF))
{
httpRpse.setContentType("application/pdf");
}
else
{
httpRpse.setContentType("text/html");
}

DBUG.DBUGLog("Length = " + length);

if(length > 0)
{
httpRpse.setContentLength(length);
}

byte[] buffer = new byte[2048];

int cnt = is.read(buffer, 0,buffer.length);

os = httpRpse.getOutputStream();

int totalCnt = 0;

while (cnt > 0)
{
os.write(buffer,0,cnt);
os.flush();

totalCnt = totalCnt + cnt;
cnt = is.read(buffer, 0,buffer.length);

}

} catch (Exception e) {

e.printStackTrace();
} finally {
if( os != null ) {
os.flush();
os.close();
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top