I have this problem having to display my jasper report on my grails application.
On the application I've installed the jasper plugin using the command: grails> install-plugin jasper
I have created sample.jrxml
having this context:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="student" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.2100000000000002"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="181" y="0" width="212" height="37"/>
<textElement textAlignment="Center">
<font size="24"/>
</textElement>
<text><![CDATA[Portal Student List]]></text>
</staticText>
</band>
</title>
<columnHeader>
<band height="26"/>
</columnHeader>
<detail>
<band height="98" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="43" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch">
<staticText>
<reportElement x="238" y="0" width="100" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Copyright]]></text>
</staticText>
</band>
</pageFooter>
</jasperReport>
And I am calling the report either using the Jasper Tag <g:jasperReport jasper="student" format="PDF"/>
or creating a new closure that would display the .pdf file directly to the browser using this code:
def report() {
def reportDef = new JasperReportDef(folder: 'reports', name:'student.jrxml', fileFormat: JasperExportFormat.PDF_FORMAT)
reportDef.contentStream = jasperService.generateReport(reportDef)
response.contentType = reportDef.fileFormat.mimeTyp
response.characterEncoding = 'UTF-8'
response.outputStream << reportDef.contentStream.toByteArray()
}
Either of the methods used returns a single blank page.
How can I resolve this problem?
Thanks