#include <Info.hh>
Collaboration diagram for pdf::page::CInfo:
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).
|
default constructor
00042 : m_rotation( 0 ) 00043 { 00044 } |
|
initialize the media box to have "width" and "height", and other fields to their default values.
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 } |
|
destructor does nothing.
00065 { 00066 } |
|
operator=() use the copy-swap idiom.
|
|
initialize the media box to have "width" and "height", and other fields to their default values.
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 } |
|
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 } |
|
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 } |
|
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
00153 { 00154 if ( rotation % 90 != 0 || rotation > 360 ) 00155 throw util::CError( /*"invalid value of page rotation"*/ ) ; 00156 00157 m_rotation = rotation ; 00158 } |
|
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 } |
|
media box. i.e. paper size
|
|
crop box. default = media box
|
|
bleed box. default = crop box
|
|
trim box. default = crop box
|
|
art box. default = crop box
|
|
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. |