net.sf.jasperreports.engine

## Class JasperPrint

- java.lang.Object
- - net.sf.jasperreports.engine.JasperPrint

- All Implemented Interfaces:
    java.io.Serializable, JRPropertiesHolder

      public class JasperPrint
      extends java.lang.Object
      implements java.io.Serializable, JRPropertiesHolder

  An instance of this class represents a page-oriented document that can be viewed, printed or exported to other formats.

  When filling report designs with data, the engine produces instances of this class and these can be transferred over the network, stored in a serialized form on disk or exported to various other formats like PDF, HTML, XLS, CSV or XML.

  Version:
    $Id: JasperPrint.java 6841 2014-01-28 14:51:00Z teodord $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net)
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `PROPERTIES_PRINT_TRANSFER_PREFIX` Prefix for JasperReports properties that specify properties to be transfered from report templates to print objects.
    `static java.lang.String` | `PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS`
    `static java.lang.String` | `PROPERTY_CREATE_BOOKMARKS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JasperPrint()` Creates a new empty document.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBookmark(PrintBookmark bookmark)` Adds a new page to the document.
    `void` | `addOrigin(JROrigin origin)` Adds a new style to the report origins.
    `void` | `addPage(int index, JRPrintPage page)` Adds a new page to the document, placing it at the specified index.
    `void` | `addPage(JRPrintPage page)` Adds a new page to the document.
    `void` | `addStyle(JRStyle style)` Adds a new style to the report styles.
    `void` | `addStyle(JRStyle style, boolean isIgnoreDuplicate)` Adds a new style to the report styles.
    `protected void` | `collectAnchors(java.util.Collection<JRPrintElement> elements, int pageIndex, int offsetX, int offsetY)`
    `java.util.Map<java.lang.String,JRPrintAnchorIndex>` | `getAnchorIndexes()`
    `java.util.List<PrintBookmark>` | `getBookmarks()`
    `java.lang.Integer` | `getBottomMargin()`
    `JRStyle` | `getDefaultStyle()` Returns the default report style.
    `JRDefaultStyleProvider` | `getDefaultStyleProvider()` When we want to virtualize pages, we want a style provider that is not the print object itself.
    `java.lang.String` | `getFormatFactoryClass()` Returns the name of the class implementing the `FormatFactory` interface to use with this document.
    `java.lang.Integer` | `getLeftMargin()`
    `java.lang.String` | `getLocaleCode()` Returns the code of the default `java.util.Locale` to be used for the elements of this print object.
    `java.lang.String` | `getName()`
    `OrientationEnum` | `getOrientationValue()` Returns the page orientation.
    `JROrigin[]` | `getOrigins()` Gets an array of report origins.
    `java.util.List<JROrigin>` | `getOriginsList()` Gets a list of report origins.
    `java.util.Map<JROrigin,java.lang.Integer>` | `getOriginsMap()` Gets a map of report origins.
    `int` | `getPageHeight()`
    `java.util.List<JRPrintPage>` | `getPages()` Returns a list of all pages in the filled report.
    `int` | `getPageWidth()`
    `JRPropertiesHolder` | `getParentProperties()` Returns the parent properties holder, whose properties are used as defaults for this object.
    `JRPropertiesMap` | `getPropertiesMap()` Returns this object's properties map.
    `java.lang.String` | `getProperty(java.lang.String propName)`
    `java.lang.String[]` | `getPropertyNames()`
    `java.lang.Integer` | `getRightMargin()`
    `JRStyle[]` | `getStyles()` Gets an array of report styles.
    `java.util.List<JRStyle>` | `getStylesList()` Gets a list of report styles.
    `java.util.Map<java.lang.String,JRStyle>` | `getStylesMap()` Gets a map of report styles.
    `java.lang.String` | `getTimeZoneId()` Returns the `ID` of the default `java.util.TimeZone` to be used for the elements of this print object.
    `java.lang.Integer` | `getTopMargin()`
    `boolean` | `hasProperties()` Checks whether the object has any properties.
    `JROrigin` | `removeOrigin(JROrigin origin)`
    `JRPrintPage` | `removePage(int index)` Removes a page from the document.
    `void` | `removeProperty(java.lang.String propName)`
    `JRStyle` | `removeStyle(JRStyle style)`
    `JRStyle` | `removeStyle(java.lang.String styleName)`
    `void` | `setBookmarks(java.util.List<PrintBookmark> bookmarks)`
    `void` | `setBottomMargin(java.lang.Integer bottomMargin)` Sets the bottom page margin.
    `void` | `setDefaultStyle(JRStyle style)` Sets the default report style.
    `void` | `setFormatFactoryClass(java.lang.String formatFactoryClass)` Sets the name of the class implementing the `FormatFactory` interface to use with this document.
    `void` | `setLeftMargin(java.lang.Integer leftMargin)` Sets the left page margin.
    `void` | `setLocaleCode(java.lang.String localeCode)` Sets the the code of the default `java.util.Locale` to be used for this object.
    `void` | `setName(java.lang.String name)` Sets the name of the document.
    `void` | `setOrientation(OrientationEnum orientationValue)` Sets the page orientation.
    `void` | `setPageHeight(int pageHeight)` Sets the page height.
    `void` | `setPageWidth(int pageWidth)` Sets the page width.
    `void` | `setProperty(java.lang.String propName, java.lang.String value)`
    `void` | `setRightMargin(java.lang.Integer rightMargin)` Sets the right page margin.
    `void` | `setTimeZoneId(java.lang.String timeZoneId)` Sets the the `ID` of the default `java.util.TimeZone` to be used for this object.
    `void` | `setTopMargin(java.lang.Integer topMargin)` Sets the top page margin.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROPERTIES_PRINT_TRANSFER_PREFIX

          public static final java.lang.String PROPERTIES_PRINT_TRANSFER_PREFIX

      Prefix for JasperReports properties that specify properties to be transfered from report templates to print objects.
      See Also:
        `JRPropertiesUtil.transferProperties(JRPropertiesHolder, JRPropertiesHolder, String)`, Constant Field Values

    - #### PROPERTY_CREATE_BOOKMARKS

          public static final java.lang.String PROPERTY_CREATE_BOOKMARKS

      See Also:
        Constant Field Values

    - #### PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS

          public static final java.lang.String PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JasperPrint

          public JasperPrint()

      Creates a new empty document.

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Returns:
        Returns the name of the document

    - #### setName

          public void setName(java.lang.String name)

      Sets the name of the document.
      Parameters:
        `name` - name of the document

    - #### getPageWidth

          public int getPageWidth()

      Returns:
        Returns the page width

    - #### setPageWidth

          public void setPageWidth(int pageWidth)

      Sets the page width.
      Parameters:
        `pageWidth` - page width

    - #### getPageHeight

          public int getPageHeight()

      Returns:
        Returns the page height.

    - #### setPageHeight

          public void setPageHeight(int pageHeight)

      Sets the page height.
      Parameters:
        `pageHeight` - page height

    - #### getTopMargin

          public java.lang.Integer getTopMargin()

      Returns:
        Returns the top page margin

    - #### setTopMargin

          public void setTopMargin(java.lang.Integer topMargin)

      Sets the top page margin.
      Parameters:
        `topMargin` - top page margin

    - #### getLeftMargin

          public java.lang.Integer getLeftMargin()

      Returns:
        Returns the left page margin

    - #### setLeftMargin

          public void setLeftMargin(java.lang.Integer leftMargin)

      Sets the left page margin.
      Parameters:
        `leftMargin` - left page margin

    - #### getBottomMargin

          public java.lang.Integer getBottomMargin()

      Returns:
        Returns the bottom page margin

    - #### setBottomMargin

          public void setBottomMargin(java.lang.Integer bottomMargin)

      Sets the bottom page margin.
      Parameters:
        `bottomMargin` - bottom page margin

    - #### getRightMargin

          public java.lang.Integer getRightMargin()

      Returns:
        Returns the right page margin

    - #### setRightMargin

          public void setRightMargin(java.lang.Integer rightMargin)

      Sets the right page margin.
      Parameters:
        `rightMargin` - right page margin

    - #### getOrientationValue

          public OrientationEnum getOrientationValue()

      Returns the page orientation.
      See Also:
        `PORTRAIT,`, `LANDSCAPE`

    - #### setOrientation

          public void setOrientation(OrientationEnum orientationValue)

      Sets the page orientation.
      See Also:
        `PORTRAIT,`, `LANDSCAPE`

    - #### hasProperties

          public boolean hasProperties()

      Description copied from interface: `JRPropertiesHolder`
      Checks whether the object has any properties.
      Specified by:
        `hasProperties` in interface `JRPropertiesHolder`
      Returns:
        whether the object has any properties

    - #### getPropertiesMap

          public JRPropertiesMap getPropertiesMap()

      Description copied from interface: `JRPropertiesHolder`
      Returns this object's properties map.
      Specified by:
        `getPropertiesMap` in interface `JRPropertiesHolder`
      Returns:
        this object's properties map

    - #### getParentProperties

          public JRPropertiesHolder getParentProperties()

      Description copied from interface: `JRPropertiesHolder`
      Returns the parent properties holder, whose properties are used as defaults for this object.
      Specified by:
        `getParentProperties` in interface `JRPropertiesHolder`
      Returns:
        the parent properties holder, or `null` if no parent

    - #### getPropertyNames

          public java.lang.String[] getPropertyNames()

    - #### getProperty

          public java.lang.String getProperty(java.lang.String propName)

    - #### setProperty

          public void setProperty(java.lang.String propName,
                         java.lang.String value)

    - #### removeProperty

          public void removeProperty(java.lang.String propName)

    - #### getDefaultStyle

          public JRStyle getDefaultStyle()

      Returns the default report style.

    - #### setDefaultStyle

          public void setDefaultStyle(JRStyle style)

      Sets the default report style.

    - #### getDefaultStyleProvider

          public JRDefaultStyleProvider getDefaultStyleProvider()

      When we want to virtualize pages, we want a style provider that is not the print object itself.

    - #### getStyles

          public JRStyle[] getStyles()

      Gets an array of report styles.

    - #### getStylesList

          public java.util.List<JRStyle> getStylesList()

      Gets a list of report styles.

    - #### getStylesMap

          public java.util.Map<java.lang.String,JRStyle> getStylesMap()

      Gets a map of report styles.

    - #### addStyle

          public void addStyle(JRStyle style)
                        throws JRException

      Adds a new style to the report styles.
      Throws:
        `JRException`

    - #### addStyle

          public void addStyle(JRStyle style,
                      boolean isIgnoreDuplicate)
                        throws JRException

      Adds a new style to the report styles.
      Throws:
        `JRException`

    - #### removeStyle

          public JRStyle removeStyle(java.lang.String styleName)

    - #### removeStyle

          public JRStyle removeStyle(JRStyle style)

    - #### getOrigins

          public JROrigin[] getOrigins()

      Gets an array of report origins.

    - #### getOriginsList

          public java.util.List<JROrigin> getOriginsList()

      Gets a list of report origins.

    - #### getOriginsMap

          public java.util.Map<JROrigin,java.lang.Integer> getOriginsMap()

      Gets a map of report origins.

    - #### addOrigin

          public void addOrigin(JROrigin origin)

      Adds a new style to the report origins.

    - #### removeOrigin

          public JROrigin removeOrigin(JROrigin origin)

    - #### getPages

          public java.util.List<JRPrintPage> getPages()

      Returns a list of all pages in the filled report.

    - #### addPage

          public void addPage(JRPrintPage page)

      Adds a new page to the document.

    - #### addPage

          public void addPage(int index,
                     JRPrintPage page)

      Adds a new page to the document, placing it at the specified index.

    - #### removePage

          public JRPrintPage removePage(int index)

      Removes a page from the document.

    - #### getBookmarks

          public java.util.List<PrintBookmark> getBookmarks()

    - #### addBookmark

          public void addBookmark(PrintBookmark bookmark)

      Adds a new page to the document.

    - #### setBookmarks

          public void setBookmarks(java.util.List<PrintBookmark> bookmarks)

    - #### getAnchorIndexes

          public java.util.Map<java.lang.String,JRPrintAnchorIndex> getAnchorIndexes()

    - #### collectAnchors

          protected void collectAnchors(java.util.Collection<JRPrintElement> elements,
                            int pageIndex,
                            int offsetX,
                            int offsetY)

    - #### getFormatFactoryClass

          public java.lang.String getFormatFactoryClass()

      Returns the name of the class implementing the `FormatFactory` interface to use with this document.

    - #### setFormatFactoryClass

          public void setFormatFactoryClass(java.lang.String formatFactoryClass)

      Sets the name of the class implementing the `FormatFactory` interface to use with this document.

    - #### getLocaleCode

          public java.lang.String getLocaleCode()

      Returns the code of the default `java.util.Locale` to be used for the elements of this print object.

      When filling a report, the value of the `REPORT_LOCALE` parameter (or the default locale if the parameter has no explicit value) is saved using this attribute. Some elements (e.g. elements rendered by a subreport) in the print object can override this default locale.

      Returns:
        the code of the default `java.util.Locale` for this object
      See Also:
        `JRPrintText.getLocaleCode()`

    - #### setLocaleCode

          public void setLocaleCode(java.lang.String localeCode)

      Sets the the code of the default `java.util.Locale` to be used for this object.
      Parameters:
        `localeCode` - the locale code, using the `java.util.Locale.toString()` convention.
      See Also:
        `getLocaleCode()`, `Locale.toString()`

    - #### getTimeZoneId

          public java.lang.String getTimeZoneId()

      Returns the `ID` of the default `java.util.TimeZone` to be used for the elements of this print object.

      When filling a report, the value of the `REPORT_TIME_ZONE` parameter (or the default time zine if the parameter has no explicit value) is saved using this attribute. Some elements (e.g. elements rendered by a subreport) in the print object can override this default time zone.

      Returns:
        the ID of the default `java.util.TimeZone` for this object
      See Also:
        `JRPrintText.getTimeZoneId()`

    - #### setTimeZoneId

          public void setTimeZoneId(java.lang.String timeZoneId)

      Sets the the `ID` of the default `java.util.TimeZone` to be used for this object.
      Parameters:
        `timeZoneId` - the time zone ID
      See Also:
        `getTimeZoneId()`, `TimeZone.getID()`

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com