pstanton Posted January 21, 2008 Posted January 21, 2008 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.
pstanton Posted January 21, 2008 Author Posted January 21, 2008 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());
lucianc Posted January 21, 2008 Posted January 21, 2008 whenNoDataType is an attribute of the jasperReport (root) JRXML element (see the JRXML reference). If you use iReport, it would be in the Report Properties dialog. HTH,Lucian
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