
.. currentmodule:: GeoExt.data

:class:`GeoExt.data.PrintPage`
================================================================================


.. cssclass:: meta


Extends
    * `Ext.util.Observable <http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.Observable>`_
    






.. class:: PrintPage

Provides a representation of a print page for
:class:`GeoExt.data.PrintProvider`. The extent of the page is stored as
``OpenLayers.Feature.Vector``. Widgets can use this to display the print
extent on the map.


    


Config Options
--------------

Configuration properties in addition to
those listed for `Ext.util.Observable <http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.Observable>`_.


.. describe:: customParams

    ``Object`` Key-value pairs of additional parameters that the
    printProvider will send to the print service for this page.

.. describe:: printProvider

    :class:`GeoExt.data.PrintProvider` The print provider to use with
    this page.




Public Properties
-----------------

Public properties in addition to those
listed for `Ext.util.Observable <http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.Observable>`_.


.. attribute:: PrintPage.center

    ``OpenLayers.LonLat`` The current center of the page. Read-only.

.. attribute:: PrintPage.customParams

    ``Object`` Key-value pairs of additional parameters that the
    printProvider will send to the print service for this page.

.. attribute:: PrintPage.feature

    ``OpenLayers.Feature.Vector`` Feature representing the page extent. To
    get the extent of the print page for a specific map, use
    ``getPrintExtent``.
    Read-only.

.. attribute:: PrintPage.rotation

    ``Float`` The current rotation of the page. Read-only.

.. attribute:: PrintPage.scale

    ``Ext.data.Record`` The current scale record of the page. Read-only.




Public Methods
--------------

Public methods in addition to those
listed for `Ext.util.Observable <http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.Observable>`_.


.. method:: PrintPage.fit

    :param fitTo: :class:`GeoExt.MapPanel` or ``OpenLayers.Map`` or ``OpenLayers.Feature.Vector``
        The map or feature to fit the page to.
    :param options: ``Object`` Additional options to determine how to fit
    
    Fits the page layout to a map or feature extent. If the map extent has
    not been centered yet, this will do nothing.
    
    Available options:
    
    * mode - ``String`` How to calculate the print extent? If "closest",
      the closest matching print extent will be chosen. If "printer", the
      chosen print extent will be the closest one that can show the entire
      ``fitTo`` extent on the printer. If "screen", it will be the closest
      one that is entirely visible inside the ``fitTo`` extent. Default is
      "printer".
    

.. method:: PrintPage.getPrintExtent

    :param map: ``OpenLayers.Map`` or :class:`GeoExt.MapPanel` the map to
        get the print extent for.
    :returns: ``OpenLayers.Bounds``
    
    Gets this page's print extent for the provided map.

.. method:: PrintPage.setCenter

    :param center: ``OpenLayers.LonLat`` The new center.
    
    Moves the page extent to a new center.

.. method:: PrintPage.setRotation

    :param rotation: ``Float`` The new rotation.
    :param force: ``Boolean`` If set to true, the rotation will also be
        set when the layout does not support it. Default is false.
    
    Sets a new rotation for the page geometry.

.. method:: PrintPage.setScale

    :param scale: ``Ext.data.Record`` The new scale record.
    :param units: ``String`` map units to use for the scale calculation.
        Optional if the ``feature`` is on a layer which is added to a map.
        If not found, "dd" will be assumed.
    
    Updates the page geometry to match a given scale. Since this takes the
    current layout of the printProvider into account, this can be used to
    update the page geometry feature when the layout has changed.




Events
------

Events in addition to those
listed for `Ext.util.Observable <http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.Observable>`_.


.. describe:: change

    Triggered when any of the page properties have changed
    
    Listener arguments:
    
    * printPage - :class:`GeoExt.data.PrintPage` this printPage
    * modifications - ``Object`` Object with one or more of
        ``scale``, ``center`` and ``rotation``, notifying
        listeners of the changed properties.



