sridhiraj Posted October 6, 2014 Share Posted October 6, 2014 Hi All,I want exact output of pdf of my .jrxml as it comes from ireport. But my servlet is not showing border. Here is the code below. Can anyone tell me the code ireport uses to export pdf.private void generatePDFOutput(HttpServletResponse resp, HttpServletRequest req, JasperPrintAccessor jasperPrintAccessor, String pageIdx, String reportFileName) throws JRException,NamingException, SQLException, IOException {ServletOutputStream ouputStream = resp.getOutputStream();byte[] bytes = null; JasperPrint jasperPrint = jasperPrintAccessor.getJasperPrint();JRPdfExporter exporter = new JRPdfExporter();exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); if (OrientationEnum.LANDSCAPE.equals(jasperPrint.getOrientationValue())){jasperPrint.setOrientation(OrientationEnum.LANDSCAPE);req.setAttribute("orientation", "LANDSCAPE");}bytes = JasperExportManager.exportReportToPdf(jasperPrint); resp.setContentType("application/pdf");resp.setContentLength(bytes.length);String reportType = req.getParameter("reportType");if(reportType != null)resp.setHeader("Content-Disposition", "attachment; filename=""+reportFileName+".pdf"");elseresp.setHeader("Content-Disposition", "inline; filename=""+reportFileName+".pdf"");//resp.getWriter().write(bytes, 0, bytes.length);ouputStream.write(bytes, 0, bytes.length);ouputStream.flush();ouputStream.close(); } Link to comment Share on other sites More sharing options...
djohnson53 Posted October 6, 2014 Share Posted October 6, 2014 I noticed that you were having trouble with our Anti-Spam system. I've adjusted it to trust you. You should have no more problems. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now