Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

pdf::page::CInfo Class Reference

page info class More...

#include <Info.hh>

Collaboration diagram for pdf::page::CInfo:

Collaboration graph
[legend]
List of all members.

Public Methods

Private Attributes


Detailed Description

page info class

this class stores data structures descripting a page in a PDF file. it contains the following data:

MediaBox: A rectangle, expressed in default user space units, defining the boundaries of the physical medium on which the page is intended to be displayed or printed.

CropBox: A rectangle, expressed in default user space units, defining the visible region of default user space. When the page is displayed or printed,its contents are to be clipped (cropped) to this rectangle and then imposed on the output medium in some implementation-depened manner. Default value: the value of MediaBox.

BleedBox: A rectangle, expressed in default user space units, defining the region to which the contents of the page should be clipped when output in a production environment. Default value:the value of CropBox.

TrimBox: A rectangle, expressed in default user space units, defining the intended dimensions of the fnished page after trimming. Default value: the value of CropBox.

ArtBox: A rectangle,expressed in default user space units,defining the extent of the page's meaningful content (including potential white space) as intended by the page's creator. Default value: the value of CropBox.

Rotate: The number of degrees by which the page should be rotated clockwise when displayed or printed. The value must be a multiple of 90. Default value: 0.

all units of the boxes in PDF default user space (1 unit = 1/72 inchs).


Constructor & Destructor Documentation

pdf::page::CInfo::CInfo  
 

default constructor

00042     : m_rotation( 0 )
00043 {
00044 }

pdf::page::CInfo::CInfo double    width,
double    height
 

initialize the media box to have "width" and "height", and other fields to their default values.

Parameters:
width  media box width in default user space
height  media box height in default user space
See also:
Assign()

00054     : m_media_box( 0, width, height, 0 ),
00055       m_crop_box( m_media_box ),
00056       m_bleed_box( m_crop_box ), m_trim_box( m_crop_box ),
00057       m_art_box( m_crop_box ),
00058       m_rotation( 0 )
00059 {
00060 }

pdf::page::CInfo::~CInfo  
 

destructor does nothing.

00065 {
00066 }


Member Function Documentation

CInfo & pdf::page::CInfo::operator= const CInfo &    other
 

operator=() use the copy-swap idiom.

00071 {
00072     CInfo temp( other ) ;
00073     Swap( temp ) ;
00074     
00075     // after doing all the work, they should be the same
00076     assert( *this == other ) ;
00077     
00078     return *this ;
00079 }

void pdf::page::CInfo::Assign double    width,
double    height
 

initialize the media box to have "width" and "height", and other fields to their default values.

Parameters:
width  media box width in default user space
height  media box height in default user space

00088 {
00089     m_media_box.Assign( 0, width, height, 0 ) ;
00090     m_art_box = m_trim_box = m_bleed_box = m_crop_box = m_media_box ;
00091     m_rotation = 0 ;
00092 }

void pdf::page::CInfo::Swap CInfo &    other
 

swap two objects. exchange their values.

00109 {
00110     m_media_box.Swap( other.m_media_box ) ;
00111     m_crop_box.Swap( other.m_crop_box ) ;
00112     m_bleed_box.Swap( other.m_bleed_box ) ;
00113     m_trim_box.Swap( other.m_trim_box ) ;
00114     m_art_box.Swap( other.m_art_box ) ;
00115     
00116     std::swap( m_rotation, other.m_rotation ) ;
00117 }

bool pdf::page::CInfo::operator== const CInfo &    info const
 

equality operator==().

00097 {
00098     return m_media_box == info.m_media_box &&
00099            m_crop_box  == info.m_crop_box  &&
00100            m_bleed_box == info.m_bleed_box &&
00101            m_trim_box  == info.m_trim_box  &&
00102            m_art_box   == info.m_art_box   &&
00103            m_rotation  == info.m_rotation ;
00104 }

void pdf::page::CInfo::Rotation int    rotation
 

this function has to check if the input value is valid, so it cannot be inline. if the input value is invalid, it will throw an exception of util::CError

Parameters:
rotation  page rotation. must be multiple of 90 and exceed 360

00153 {
00154     if ( rotation % 90 != 0 || rotation > 360 )
00155         throw util::CError( /*"invalid value of page rotation"*/ ) ;
00156 
00157     m_rotation = rotation ;
00158 }

void pdf::page::CInfo::Write core::CDictionary   dict,
const CInfo &    def
const
 

write the information into a PDF dictionary.

00122 {
00123     assert( dict != 0 ) ;
00124 
00125     // if media box is different from the default, specify it
00126     if ( m_media_box != def.m_media_box )
00127         dict->AddPair( "MediaBox", m_media_box.Dup( ) ) ;
00128     
00129     // crop box is inheritable too.
00130     if ( m_crop_box != def.m_crop_box && m_crop_box != m_media_box )
00131         dict->AddPair( "CropBox", m_crop_box.Dup( ) ) ;
00132     
00133     if ( m_bleed_box != m_crop_box )
00134         dict->AddPair( "BleedBox", m_bleed_box.Dup( ) ) ;
00135     
00136     if ( m_trim_box != m_crop_box )
00137         dict->AddPair( "TrimBox", m_trim_box.Dup( ) ) ;
00138     
00139     if ( m_art_box != m_art_box )
00140         dict->AddPair( "ArtBox", m_art_box.Dup( ) ) ;
00141     
00142     if ( m_rotation != 0 )
00143         dict->AddPair( "Rotate", new core::CNumber( m_rotation ) ) ;
00144 }


Member Data Documentation

common::CRect pdf::page::CInfo::m_media_box [private]
 

media box. i.e. paper size

common::CRect pdf::page::CInfo::m_crop_box [private]
 

crop box. default = media box

common::CRect pdf::page::CInfo::m_bleed_box [private]
 

bleed box. default = crop box

common::CRect pdf::page::CInfo::m_trim_box [private]
 

trim box. default = crop box

common::CRect pdf::page::CInfo::m_art_box [private]
 

art box. default = crop box

int pdf::page::CInfo::m_rotation [private]
 

The number of degrees by which the page should be rotated clockwise when displayed or printed.The value must be a multiple of 90. Default value: 0.


The documentation for this class was generated from the following files:
Generated on Sun Feb 2 09:17:29 2003 for libpdf++ by doxygen1.2.16