PDF File is blank

0

Hey:D

my problem is, if i compile my project, jasper library create a empty ( blank ) pdf file. Does anyone know, where the problem is?

 

Main.java

public static void main(String[] args) throws Throwable {
 
        JasperReport jasperReport;
        JasperPrint jasperPrint;
        Map<String, Object> parameter = new HashMap<String, Object>();
 
        parameter.put("aParameter", "hallo");
 
        try {
            jasperReport = JasperCompileManager
                    .compileReport("C:/Users/CKaus/Desktop/helloworld.jrxml");
 
            jasperPrint = JasperFillManager.fillReport(jasperReport, parameter);
            JasperExportManager.exportReportToPdfFile(jasperPrint,
                    "C:/Users/CKaus/Desktop/helloworld.pdf");
 
        } catch (JRException e) {
            e.printStackTrace();
        }
    }
<?xml version="1.0" encoding="UTF-8"  ?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="Example1">
 
<parameter name="aParameter" class="java.lang.String"/>
 
<detail>
  <band height="150">
   <textField >
    <reportElement x="200" y="60" width="200" height="50" />     
    <textElement><font size="36"/></textElement>
    <textFieldExpression class="java.lang.String"><![CDATA[$P{aParameter}]]></textFieldExpression>
   </textField>
  </band>
</detail>
 
</jasperReport>

I hope anyone can help me :D

Best regards! Chris

kiasu_wc3's picture
Joined: Jul 22 2013 - 8:34am
Last seen: 6 years 8 months ago

1 Answer:

0

Hi Kiasu,

I think you need to specify somewhere where does your report gets the data.
A sort of connection string.

Have you tested the report in iReport!?

Kind regards,

Paulo

pssp25's picture
-3
Joined: Feb 28 2013 - 6:58am
Last seen: 6 years 8 months ago
Feedback