kiasu_wc3 Posted July 22, 2013 Share Posted July 22, 2013 Hey:Dmy problem is, if i compile my project, jasper library create a empty ( blank ) pdf file. Does anyone know, where the problem is? Main.javapublic 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(); } }[/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="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>[/code]I hope anyone can help me :DBest regards! Chris Link to comment Share on other sites More sharing options...
pssp25 Posted July 23, 2013 Share Posted July 23, 2013 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 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