JasperReports Ultimate Guide - Sample Reference - Schema Reference - Configuration Reference - API (Javadoc)
JasperReports - Landscape Sample (version 5.6.0) |

Shows how reports can be generated and printed in "Landscape" page format.
Download All Sample Source Files
Browse Sample Source Files on SVN

Main Features in This Sample
| Creating Landscape Orientation Report Templates

top
| Creating Landscape Orientation Report Templates | Documented by Sanda Zaharia
| Description / Goal |  | How to create landscape orientation reports.
| Since |  | 0.1.0
| This feature is used when a report should be visualized or printed in the `Landscape` page layout. A page is considered to be in a `Landscape` orientation when its width and height appear as interchanged. In order to manage its pages layout, the `<jasperReport />` element contains the `orientation` attribute. Values allowed for this attribute are: `Portrait` `Landscape` By default, in JasperReports pages are visualized as `Portrait`. The `orientation` being an attribute at report level, its value applies to all pages in the generated document. Below is a code snippet showing how to set in a report the `Landscape` orientation:
    <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="LandscapeReport" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="842" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
Here one can observe that `pageWidth` and `pageHeight` values were interchanged and the `orientation` attribute takes the `Landscape` value. Running the Sample Running the sample requires the Apache Ant library. Make sure that `ant` is already installed on your system (version 1.5 or later). In a command prompt/terminal window set the current folder to `demo/samples/landscape` within the JasperReports source project and run the `> ant test view` command. It will generate all supported document types containing the sample report in the `demo/samples/landscape/build/reports` directory. Then the report will open in the JasperReports internal viewer.

© 2001- Jaspersoft Corporation www.jaspersoft.com