![]() |
#include <Page.h>
Public Types | |
enum | Box { e_media, e_crop, e_bleed, e_trim, e_art } |
PDF page can define as many as five separate boundaries to control various aspects of the imaging process (for more details please refer to Section 10.10.1 'Page Boundaries' in PDF Reference Manual):. More... | |
enum | Rotate { e_0, e_90, e_180, e_270 } |
Specifies page rotation, in degrees. More... | |
Public Member Functions | |
Page (SDF::Obj page_dict=0) | |
Initialize a page using an existing low-level Cos/SDF page object. | |
Page (const Page &p) | |
Page & | operator= (const Page &p) |
bool | IsValid () const |
int | GetIndex () const |
Rect | GetBox (Box type) const |
void | SetBox (Box type, const Rect &box) const |
Sets the page bounding box specified by 'page_region' for this page. | |
Rect | GetCropBox () const |
void | SetCropBox (const Rect &box) |
Sets the crop box for this page. | |
Rect | GetMediaBox () const |
void | SetMediaBox (const Rect &box) |
Sets the media box for this page. | |
Rect | GetBoundingBox () const |
Rotate | GetRotation () const |
void | SetRotation (Rotate angle) |
Sets the rotation value for this page. | |
double | GetPageWidth (Box box_type=e_crop) |
double | GetPageHeight (Box box_type=e_crop) |
Common::Matrix2D | GetDefaultMatrix (bool flip_y=false, Box box_type=e_crop, Rotate angle=e_0) const |
SDF::Obj | GetAnnots () const |
Returns SDF/Cos array containing annotation dictionaries. | |
UInt32 | GetNumAnnots () const |
Returns the number of annotations on a page. | |
Annot | GetAnnot (UInt32 index) const |
Returns the annotation on the page. | |
void | AnnotInsert (UInt32 pos, Annot &annot) |
Adds an annotation at the specified location in a page's annotation array. | |
void | AnnotPushBack (Annot &annot) |
Adds an annotation to the end of a page's annotation array. | |
void | AnnotPushFront (Annot &annot) |
Adds an annotation to the beginning of a page's annotation array. | |
void | AnnotRemove (Annot &annot) |
Removes the given annotation from the page. | |
void | AnnotRemove (UInt32 index) |
Removes the annotation at a given location. | |
void | Scale (double scale) |
A utility method used to scale physical dimensions of the page including all page content. | |
void | FlattenField (class Field filed) |
Flatten/Merge existing form field appearances with the page content and remove widget annotation. | |
bool | HasTransition () const |
Tests whether this page has a transition. | |
double | GetUserUnitSize () const |
Returns the UserUnit value for the page. | |
void | SetUserUnitSize (double unit_size) |
Sets the UserUnit value for a page. | |
SDF::Obj | GetResourceDict () const |
SDF::Obj | GetContents () const |
SDF::Obj | GetSDFObj () const |
Returns the page dictionary. | |
SDF::Obj | FindInheritedAttribute (const char *attrib) const |
Some of the page attributes are designated as inheritable. | |
operator bool () |
Among other associated objects, a page object contains:
PDF page can define as many as five separate boundaries to control various aspects of the imaging process (for more details please refer to Section 10.10.1 'Page Boundaries' in PDF Reference Manual):.
pdftron::PDF::Page::Page | ( | SDF::Obj | page_dict = 0 |
) |
Initialize a page using an existing low-level Cos/SDF page object.
page_dict | - a low-level (SDF/Cos) page dictionary. |
Because PDF::PDFDoc provides a complete high-level interface for Page creation and traversal this constructor is rarely used.
pdftron::PDF::Page::Page | ( | const Page & | p | ) |
bool pdftron::PDF::Page::IsValid | ( | ) | const |
Referenced by operator bool().
int pdftron::PDF::Page::GetIndex | ( | ) | const |
type | The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. |
Sets the page bounding box specified by 'page_region' for this page.
type | The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. | |
box | A rectangle specifying the coordinates to set for the box. The coordinates are specified in user space units. |
Rect pdftron::PDF::Page::GetCropBox | ( | ) | const |
void pdftron::PDF::Page::SetCropBox | ( | const Rect & | box | ) |
Sets the crop box for this page.
The crop box is the region of the page to display and print.
box | the new crop box for this page. The page dimensions are specified in user space coordinates. |
Rect pdftron::PDF::Page::GetMediaBox | ( | ) | const |
if | the page is missing media box the function throws Exception |
void pdftron::PDF::Page::SetMediaBox | ( | const Rect & | box | ) |
Sets the media box for this page.
box | the new media box for this page. The page dimensions are specified in user space coordinates. |
Rect pdftron::PDF::Page::GetBoundingBox | ( | ) | const |
Rotate pdftron::PDF::Page::GetRotation | ( | ) | const |
void pdftron::PDF::Page::SetRotation | ( | Rotate | angle | ) |
Sets the rotation value for this page.
angle | Rotation value to be set for a given page. Must be one of the Page::Rotate values. |
double pdftron::PDF::Page::GetPageWidth | ( | Box | box_type = e_crop |
) |
box_type | indicates the page box/region to query for width. |
double pdftron::PDF::Page::GetPageHeight | ( | Box | box_type = e_crop |
) |
box_type | indicates the page box/region to query for height. |
Common::Matrix2D pdftron::PDF::Page::GetDefaultMatrix | ( | bool | flip_y = false , |
|
Box | box_type = e_crop , |
|||
Rotate | angle = e_0 | |||
) | const |
flip_y | this parameter can be used to mirror the page. if 'flip_y' is true the Y axis is not flipped and it is increasing, otherwise Y axis is decreasing. | |
box_type | an optional parameter used to specify the page box/region that the matrix should map to. By default, the function transforms user space coordinates to cropped coordinates. | |
angle | an optional parameter used to specify page rotation in addition to the rotation specified in the page dictionary. This parameter is usually used to rotate the page without modifying the document itself. |
SDF::Obj pdftron::PDF::Page::GetAnnots | ( | ) | const |
Returns SDF/Cos array containing annotation dictionaries.
See Section 8.4 in the PDF Reference for a description of the annotation array.
UInt32 pdftron::PDF::Page::GetNumAnnots | ( | ) | const |
Returns the number of annotations on a page.
Widget annotations (form fields) are included in the count.
Returns the annotation on the page.
index | - The index of the annotation to get on a page. The first annotation on a page has an index of zero. |
Adds an annotation at the specified location in a page's annotation array.
pos | - The location in the array to insert the object. The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= GetNumAnnots(), the method appends the annotation to the array. | |
annot | - The annotation to add. |
void pdftron::PDF::Page::AnnotPushBack | ( | Annot & | annot | ) |
Adds an annotation to the end of a page's annotation array.
annot | - The annotation to prepend in a page's annotation array. |
void pdftron::PDF::Page::AnnotPushFront | ( | Annot & | annot | ) |
Adds an annotation to the beginning of a page's annotation array.
annot | - The annotation to append in a page's annotation array. |
void pdftron::PDF::Page::AnnotRemove | ( | Annot & | annot | ) |
Removes the given annotation from the page.
index | - A zero based index of the annotation to remove. |
void pdftron::PDF::Page::AnnotRemove | ( | UInt32 | index | ) |
Removes the annotation at a given location.
index | - A zero based index of the annotation to remove. |
void pdftron::PDF::Page::Scale | ( | double | scale | ) |
A utility method used to scale physical dimensions of the page including all page content.
scale | A number greater than 0 which is used as a scale factor. For example, calling page.Scale(0.5) will reduce physical dimensions of the page to half its original size, whereas page.Scale(2) will double the physical dimensions of the page and will rescale all page content appropriately. |
void pdftron::PDF::Page::FlattenField | ( | class Field | filed | ) |
Flatten/Merge existing form field appearances with the page content and remove widget annotation.
Form 'flattening' refers to the operation that changes active form fields into a static area that is part of the PDF document, just like the other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields.
bool pdftron::PDF::Page::HasTransition | ( | ) | const |
Tests whether this page has a transition.
double pdftron::PDF::Page::GetUserUnitSize | ( | ) | const |
Returns the UserUnit value for the page.
A UserUnit is a positive number giving the size of default user space units, in multiples of 1/72 inch.
void pdftron::PDF::Page::SetUserUnitSize | ( | double | unit_size | ) |
SDF::Obj pdftron::PDF::Page::GetResourceDict | ( | ) | const |
if | the page is missing resource dictionary the function throws Exception |
SDF::Obj pdftron::PDF::Page::GetContents | ( | ) | const |
SDF::Obj pdftron::PDF::Page::GetSDFObj | ( | ) | const |
Returns the page dictionary.
SDF::Obj pdftron::PDF::Page::FindInheritedAttribute | ( | const char * | attrib | ) | const |
Some of the page attributes are designated as inheritable.
If such an attribute is omitted from a page object, its value is inherited from an ancestor node in the page tree. If the attribute is a required one, a value must be supplied in an ancestor node; if it is optional and no inherited value is specified, the default value should be used.
The function walks up the page inheritance tree in search for specified attribute.
pdftron::PDF::Page::operator bool | ( | ) | [inline] |