Blank PDF Even with the Simplest Jasperreport Jrxml

Blank PDF even with the simplest Jasperreport jrxml

After all, JasperRunManager.runReportToPdfStream(reportStream, servletOutputStream, parameterMap, new JREmptyDataSource()); solved the problem.

Quote from Sanda of Jasperreport:

By default, when no datasource info is present in a report, JR generates no pages. Another option (which can be set in the report's whenNoDataType attribute) would be to print all report sections, excepting the <detail>.

This report contains a detail section, but only with some static data. To ensure this section will be printed too, the simplest way is to provide an empty data source, containing a single empty record.

Source: https://community.jaspersoft.com/questions/537650/blank-pdf-even-simplest-jrxml

Jasper Reports generating blank pdf

If you want title, headers, etc, but no Detail Band if there is an empty resulse, then set the WhenNoDataType=AllSectionsNoDetail attribute. This will confirm the problem is due to no resultset being returned from the datasource.
https://community.jaspersoft.com/wiki/empty-report-problem

Jasper creates empty PDF

The detail band of your report will be repeated for every row in the datasource. However your filling the report with an empty data source, this is why the band is not showing. Try moving your textfield in the title band to see it.

Report coming up blank using Java code, previews OK in the Studio

I see two options for this:

  1. In your java code import the net.sf.jasperreports.engine.JREmptyDataSource class and fill the jasperPrint like so:

    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, new JREmptyDataSource());

    This should guarantee that your detail band is displayed once. This is what JasperSoft Studio uses when you preview a report with One Empty Record Data Adapter.

  2. In JasperSoft Studio, move all the content out of the Detail band to Summary band, for example, and in Report Properties tab select:

    When No Data Type: All Sections No Detail

    This way all the other bands, except the Detail one, will be rendered when you don't provide any data.

Jasper report blank page

You are confusing the report data with parameters. I don't see that you have any report data, which is why you are getting an empty report. Further, you are filling a parameter named "Field" instead of the actual report data. So you either need to create a parameter called "Field" in your report, and then refer to it in the detail band, OR you need to pass the report data into your report something like

JRBeanCollectionDataSource data = new JRBeanCollectionDataSource(dataSet);
jasperPrint = JasperFillManager.fillReport(jasperReport, parameterMap, data);

where dataSet is a collection, such as List<?>. Within the List, you would have an object where one of the properties is Field.



Related Topics



Leave a reply



Submit