Hi,
I am using jdev 11.1.2.4.
I've a created a Jasper report and calling it from ADF as pdf output.
is there anyway I can send it directly to a printer?
I am using below method to run the report as pdf.
public static void runReport(String repPath, java.util.Map param) throws Exception
{
Connection conn = null;
try
{
HttpServletResponse response = getResponse();
ServletOutputStream out = response.getOutputStream();
response.setHeader("Cache-Control", "max-age=0");
response.setContentType("application/pdf");
ServletContext context = getContext();
InputStream fs = context.getResourceAsStream("/reports/" + repPath);
//System.out.println(fs.toString());
JasperReport template = (JasperReport) JRLoader.loadObject(fs);
template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
conn = getConnection();
JasperPrint print = JasperFillManager.fillReport(template, param, conn);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(print, baos);
out.write(baos.toByteArray());
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
}
catch (Exception jex)
{
jex.printStackTrace();
}
finally
{
close(conn);
}
}
thanks