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
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
18 Answers:
Posted on April 17, 2007 at 1:27pm
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 Mehta
apurvamca@gmail.com
How jasper report working with jsp.
Thanks,
Apurva Mehta
apurvamca@gmail.com
Posted on April 18, 2007 at 3:48am
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 browser
public 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
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 browser
public 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
Posted on April 18, 2007 at 8:16am
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.
Teodor
Post edited by: teodord, at: 2007/04/18 08:29
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.
Teodor
Post edited by: teodord, at: 2007/04/18 08:29
Posted on April 19, 2007 at 4:26am
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,
dolly
Post edited by: dolly_11, at: 2007/04/19 04:31
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,
dolly
Post edited by: dolly_11, at: 2007/04/19 04:31
Posted on April 19, 2007 at 9:09am
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/CHI...
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/CHI...
Posted on April 19, 2007 at 9:32am
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
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
Posted on April 19, 2007 at 9:46am
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 help
Thanks,
dolly
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 help
Thanks,
dolly
Posted on April 19, 2007 at 11:27am
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
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
Posted on April 19, 2007 at 12:17pm
Hi,
Try attach it again, or send it to me by email:
teodord@users.sourceforge.net
I don't see it on the forum.
Thanks,
Teodor
Try attach it again, or send it to me by email:
teodord@users.sourceforge.net
I don't see it on the forum.
Thanks,
Teodor
Posted on April 20, 2007 at 2:58am
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/CHI...
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/CHI...
Posted on April 26, 2007 at 8:38am
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:41
Post edited by: dolly_11, at: 2007/04/26 08:45
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:41
Post edited by: dolly_11, at: 2007/04/26 08:45
Posted on April 26, 2007 at 3:06pm
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 appreciate
thanks
bye
marco
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 appreciate
thanks
bye
marco