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

Opening a pdf report in a browser ( new window).


nikitha

Recommended Posts

Hi,

I have a requirement , to export  the report of pdf type in a separate browser, could anyone help me.

Here, the code which i am using:

if

 

(format.equalsIgnoreCase("pdf")){new JRPdfExporter();JASPER_PRINT, jprint);OUTPUT_STREAM, pdfReport);contentType = "application/pdf"; fileName = jrFileName + "__" + ".pdf";

The output, which i am getting is right, but it is opening in the Adobe reader window, please help me to open in a browser.

Thanks and Regards, 

Naveen Chanda                                 

JRPdfExporter exporter =

exporter.setParameter(JRExporterParameter.

exporter.setParameter(JRExporterParameter.

exporter.exportReport();

bytes = pdfReport.toByteArray();

 

 

 

}

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Use this way,

JasperPrint jasperPrint = JasperFillManager.fillReport( new FileInputStream(new File(reportFile, reportName + ".jasper")),parameters, connection); byte[] bytes = JasperExportManager.exportReportToPdf(jasperPrint); length);
response.getOutputStream().write(bytes);
response.setContentType(
"application/pdf");
JasperPrintManager.printReportToPdf(jasperPrint);
servletOutputStream.flush();
servletOutputStream.close();

Regards.
Imran

 

 

 

response.setContentLength(bytes.

 

Link to comment
Share on other sites

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...