dolly_11 Posted April 17, 2007 Share Posted April 17, 2007 Hi, I'm using the same jrxml file for both HTML & PDF reports.But when i generate the HTML report the report is generated completely but the PDF report is showing blank white page without any Report.Is there any difference between the page settings for HTML & PDF.I mean the content in the report is not fitting in PDF or what?? I 'm not sure but doubting????.Plzzzzzzzz wht can i do to solve this issue.........When the report is generated in HTML then why it is not generating in PDF format.....What i need to do for this....... Regards,dolly Link to comment Share on other sites More sharing options...
teodord Posted April 17, 2007 Share Posted April 17, 2007 Hi, Please attach the relevant files to this thread if you can, so that we can see what it is about. Are you generating the reports in a particular language? It might be a font related issue. Thank you,Teodor Link to comment Share on other sites More sharing options...
teodord Posted April 17, 2007 Share Posted April 17, 2007 Hi, Sorry, I did not see you were talking about images.What version of JasperReports are you using and what kind of images are they? JPG, GIF, PNG? Thank you,Teodor Link to comment Share on other sites More sharing options...
apurvamehta Posted April 17, 2007 Share Posted April 17, 2007 hi! dolly can you send me jsp example of your jasper report. i am new in jasper report. If you can send me then its really great. How jasper report working with jsp. Thanks,Apurva Mehtaapurvamca@gmail.com Link to comment Share on other sites More sharing options...
teodord Posted April 17, 2007 Share Posted April 17, 2007 Hi, You can check the webapp sample in the /demo/samples directory of our project distribution package.You have there a working web application that uses JasperReports and you can leverage the JSPs and servlets you find there. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
dolly_11 Posted April 18, 2007 Author Share Posted April 18, 2007 Hi, I'm generating the reports using JAVA/servlets.I have been generating many reports in both PDF & HTML.But i never got this sought of problem.Actually i'm using the same jrxml file for both PDF & HTML reports that are to be generated.But in HTML the report is being displayed completely but in PDF just a blank PDF report is generated without any images.Actually i'm using JFreecharts in my reports.I suspect that the contents that are to be displayed are exceeding the page in PDF report.How to add new page if the content exceeds the existing page???..Here is my sample code below.........//dynamically display the report on browserpublic static void generateRespondPDFReport(String sourceFile, HashMap parameters, String destFileName, HttpServletRequest request, HttpServletResponse response) throws Exception{ JasperPrint jasperPrint = fillReport(sourceFile, parameters); try { JRPdfExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,response.getOutputStream()); exporter.exportReport(); }catch(Exception e){}Plz help me..Thanks,dolly Link to comment Share on other sites More sharing options...
teodord Posted April 18, 2007 Share Posted April 18, 2007 Hi, Check the PdfServlet inside the JasperReports source code. You'll see there what you needed to do in order to deliver PDF content to the browser.Some browsers (IE) want to know the length of the binary content before it is being sent. Otherwise they do not display anything. I hope this helps.TeodorPost edited by: teodord, at: 2007/04/18 08:29 Link to comment Share on other sites More sharing options...
dolly_11 Posted April 19, 2007 Author Share Posted April 19, 2007 Hi teodord, it did'nt work.I had used the below code instead of the previous mentioned code.JasperPrint jasperPrint = fillReport(sourceFile, parameters); ServletOutputStream out1 = response.getOutputStream(); try { // create a bytearrayoutputstream object ByteArrayOutputStream baos =new ByteArrayOutputStream(); //set the content type for the response as pdf response.setContentType("application/pdf"); //fill the outputstream object baos with jPrint object JasperExportManager.exportReportToPdfStream(jasperPrint,baos); //set the content size for the output file (pdf) response.setContentLength(baos.size());//write the exported outputstream to the servlet outputstream baos.writeTo(out1); out1.close(); } But it did'nt work.......this problem occurs even when i'm saving the report on to the disk.It does'nt happen with other reports for which i'm using the same code to generate the reports in PDF.But the content or size of the other reports that are getting generated is less when that is compared with the report which i'm facing this issue.So i feel that it is a problem related to page size.So plz tell me wht can i do to add new page inorder to get the complete content of the page.'coz currenlty the PDF report shows only one page and that too blank page without any content.So i feel that the data in my report is exceeding more then one page......And even the report is getting generated and its size is 977 KB.May be bcoz of this i'm not able to view the report.But the size of other reports which i can view with complete info is 92KB only.....Is this can be a problem..wht should i do to solve this thanks,dollyPost edited by: dolly_11, at: 2007/04/19 04:31 Link to comment Share on other sites More sharing options...
teodord Posted April 19, 2007 Share Posted April 19, 2007 Hi, You should post the JRXML. Thanks,Teodor Link to comment Share on other sites More sharing options...
dolly_11 Posted April 19, 2007 Author Share Posted April 19, 2007 Hi,here is my JRXML attached.Plz check it and let me know what i can do? [file name=CHIP_XP24000.xml size=104798]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/CHIP_XP24000.xml[/file] Link to comment Share on other sites More sharing options...
teodord Posted April 19, 2007 Share Posted April 19, 2007 Hi, I realized now we are discussing about the same thing on two different forum threads. Please do not post the same issue twice. So let's continue here. There are two images in your report. Which does not work? Both of them? What kind of images are they? If they are GIFs, can you attach them here so that we test them? Are you sure you want to use scaleImage="Clip"? This would cut the image if its real size is bigger than the image area in the report. Maybe you are seeing only the top left corner of you large image. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
dolly_11 Posted April 19, 2007 Author Share Posted April 19, 2007 Hi, Both are related but they are not the same issues.This issue is related to the complete report getting blank pdf document..whereas in the other issue about "logo not getting dislayed ........",i'm getting complete report generated but only the logo is not visible.But for that issue i identified the problem that it is not able to find the path for the image of my Logo.But i'm using the same JRXML for HTML & for PDF .But it takes the path for HTML but for PDF it is throwing the error path not found.Why is it so its not working for only PDF?Wht can i do to get the image....... And even plzz tell me abt this issue also about report being generated but not able to download as PDF.even though the file size is 982KB Thanks alot........for u'r help Teodord as atleast i'm trying to find the problem and even need u'r helpThanks,dolly Link to comment Share on other sites More sharing options...
teodord Posted April 19, 2007 Share Posted April 19, 2007 Hi, Which file has 928K? Can you save the PDF on disk and then open it with Acrobat? Thanks,Teodor Link to comment Share on other sites More sharing options...
dolly_11 Posted April 19, 2007 Author Share Posted April 19, 2007 Hi, The PDF report which is generated from the JRXML file which i have attached to this thread is of 928KB.I'm able to generate the report and save it on the disk.But when i open it using Acrobat it is showing empty (blank) report with out any content in the report.Thanks,dolly Link to comment Share on other sites More sharing options...
teodord Posted April 19, 2007 Share Posted April 19, 2007 Hi, Try attach it again, or send it to me by email:teodord@users.sourceforge.netI don't see it on the forum. Thanks,Teodor Link to comment Share on other sites More sharing options...
dolly_11 Posted April 20, 2007 Author Share Posted April 20, 2007 Hi teodord, Here I'm attaching that JRXML file again. Thanks,dolly [file name=CHIP_XP24000-3fcc7cb22aef7760d867deca85e6b04a.xml size=104798]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/CHIP_XP24000-3fcc7cb22aef7760d867deca85e6b04a.xml[/file] Link to comment Share on other sites More sharing options...
teodord Posted April 20, 2007 Share Posted April 20, 2007 OK, it looks like we are in a space-time worm-hole from which we can no longer escape.I'm asking you to send the 928k PDF and you send me JRXML again. Thanks,Teodor Link to comment Share on other sites More sharing options...
dolly_11 Posted April 26, 2007 Author Share Posted April 26, 2007 Hi,sorry for the misunderstanding......... sorry..i'm not able to attach the file as its size is more.hence i'm sending the blank PDF report through mail to u'r id teodord@users.sourceforge.net Thanks,dolly Post edited by: dolly_11, at: 2007/04/26 08:39 Post edited by: dolly_11, at: 2007/04/26 08:41Post edited by: dolly_11, at: 2007/04/26 08:45 Link to comment Share on other sites More sharing options...
nestor Posted April 26, 2007 Share Posted April 26, 2007 I think i have the same problem.Html is perfect (about 3400K), but the pdf file is empty ( 0 bytes).here is my jsp code. <%@ page language="java" contentType="text/html;charset=WINDOWS-1252"%><%@ page import="java.net.*, java.io.*, java.util.*" ......%> <%response.setContentType("application/pdf");response.addHeader("Content-Disposition", "attachment; filename=destinazione.pdf"); Hashtable parameterMap = new Hashtable();int i = 0;java.sql.Connection myConnection = null;PreparedStatement myStatement = null;out.clear();out.close();OutputStream outS = response.getOutputStream(); try{ JasperDesign jasperDesign = JRXmlLoader.load("C:\Programmi\Apache Group\Tomcat 4.1\webapps\RAPtest2\pdf\reports\provaa.jrxml"); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); String myQuery = jasperReport.getQuery().getText(); java.sql.Driver driver = (java.sql.Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); Properties properties = new Properties(); properties.put("user", "aa"); properties.put("password", "ss"); myConnection = driver.connect("jdbc:oracle:thin:@121.108.62.130:1521:ORCL", properties); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameterMap, myConnection); JasperExportManager.exportReportToPdfFile(jasperPrint,"destinazione.pdf"); }catch(Throwable ex) { String connectMsg = "Could not create the report " + ex.getMessage() + " " + ex.getLocalizedMessage(); System.out.println(connectMsg); System.err.println("nuovo tentativo 3"); System.err.println(connectMsg); ex.printStackTrace();} GlobalConfig.dbpoolfast.returnConnection("fastPR", myConnection); outS.flush();%> i've also tried with JRExporter exporter = new JRPdfExporter();exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outS);exporter.exportReport(); instead of JasperExportManager.exportReportToPdfFile(jasperPrint,"destinazione.pdf"); but it's the same. any suggestion is appreciatethanksbye marco 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