Jump to content

Recommended Posts

Posted

Hi All,

 

I've used jasper on a couple of projects in the past, and think I've set this project up correctly, yet the simplest report is returning a blank page!

 

Here's my report jrxml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport name="TestReport" pageWidth="595" pageHeight="842" columnWidth="555"
leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">
<title>
<band height="782">
<staticText>
<reportElement x="1" y="1" width="220" height="40"/>
<textElement textAlignment="Center"/>
<text><![CDATA[something in a report?]]></text>
</staticText>
</band>
</title>
</jasperReport>

 

and my java to fill it (it compiles without error via the ant task):

 

Code:
[code]JasperPrint print = JasperFillManager.fillReport(reportDir + "TestReport.jasper", new HashMap());
InputStream in = new ByteArrayInputStream(JasperExportManager.exportReportToPdf(print));
OutputStream out = new FileOutputStream(new File("C:/test.pdf"«»));
org.apache.commons.io.IOUtils.copy(in, out);
in.close();
out.flush();
out.close();

 

Why would this return a blank pdf?

 

Thanks.

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

missing JREmptyDataSource. had to change

 

 

Code:
JasperFillManager.fillReport(reportDir + "TestReport.jasper", new HashMap());

 

to

 

Code:
[code]JasperFillManager.fillReport(reportDir + "TestReport.jasper", new HashMap(), new JREmptyDataSource());

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