Class Page
Page is a high-level class representing PDF page object (see 'Page Objects' in Section 3.6.2, 'Page Tree,' in PDF Reference Manual).
Among other associated objects, a page object contains:
- A series of objects representing the objects drawn on the page (See Element and ElementReader class for examples of how to extract page content).
- A list of resources used in drawing the page
- Annotations
- Beads, private metadata, optional thumbnail image, etc.
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFNet.dll
Syntax
public class Page
Constructors
Page(Obj)
Instantiates a new page.
Declaration
public Page(Obj page_dict)
Parameters
Type | Name | Description |
---|---|---|
Obj | page_dict | the page_dict |
Methods
AddRotations(Rotate, Rotate)
Rotate r0 clockwise by r1
Declaration
public static Page.Rotate AddRotations(Page.Rotate r0, Page.Rotate r1)
Parameters
Type | Name | Description |
---|---|---|
Page.Rotate | r0 | r0 first rotation. |
Page.Rotate | r1 | r1 second rotation. |
Returns
Type | Description |
---|---|
Page.Rotate | returns r0 + r1 |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
AnnotInsert(int, Annot)
Declaration
public void AnnotInsert(int pos, Annot annot)
Parameters
Type | Name | Description |
---|---|---|
int | pos | |
Annot | annot |
AnnotPushBack(Annot)
Declaration
public void AnnotPushBack(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot |
AnnotPushFront(Annot)
Declaration
public void AnnotPushFront(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot |
AnnotRemove(int)
Removes the annoation at a given location.
Declaration
public void AnnotRemove(int pos)
Parameters
Type | Name | Description |
---|---|---|
int | pos |
|
Remarks
Removing the annotation invalidates any associated Annot object.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
AnnotRemove(Annot)
Declaration
public void AnnotRemove(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot |
DegreeToRotation(int)
Convert a number that represents rotation in degrees to a rotation enum.
Declaration
public static Page.Rotate DegreeToRotation(int r)
Parameters
Type | Name | Description |
---|---|---|
int | r | degree to convert to rotation. Valid numbers are multiples of 90. |
Returns
Type | Description |
---|---|
Page.Rotate | one of four angles; e_0, e_90, e_180 or e_270. Returns e_0 if input is not a multiple 90. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
FindInheritedAttribute(string)
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 inhritance tree in search for specified attribute.
Declaration
public Obj FindInheritedAttribute(string attrib)
Parameters
Type | Name | Description |
---|---|---|
string | attrib | the attrib |
Returns
Type | Description |
---|---|
Obj | if the attribute was found return a pointer to the value. otherwise the function return NULL. Resources dictionary (Required; inheritable) MediaBox rectangle (Required; inheritable) CropBox rectangle (Optional; inheritable) Rotate integer (Optional; inheritable) |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
FlattenField(Field)
Declaration
public void FlattenField(Field field)
Parameters
Type | Name | Description |
---|---|---|
Field | field |
GetAnnot(int)
Gets the annotation on the page.
Declaration
public Annot GetAnnot(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | index of the annotation to get on a page |
Returns
Type | Description |
---|---|
Annot | Annotation object. If the index is out of range returned Annot object is not valid (i.e. annot.IsValid() returns false). |
Remarks
The first annotation on a page has an index of zero
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetAnnots()
Gets the annotation on the page.
Declaration
public Obj GetAnnots()
Returns
Type | Description |
---|---|
Obj | Annotation object. If the index is out of range returned Annot object is not valid (i.e. annot.IsValid() returns false). |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetBox(Box)
Gets the specified box
Declaration
public Rect GetBox(Page.Box type)
Parameters
Type | Name | Description |
---|---|---|
Page.Box | type | The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. |
Returns
Type | Description |
---|---|
Rect | the box specified for the page object intersected with the media box. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetContents()
Gets the contents.
Declaration
public Obj GetContents()
Returns
Type | Description |
---|---|
Obj | NULL if page is empty, otherwise a single stream or an array of streams. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetCropBox()
Gets the crop box.
Declaration
public Rect GetCropBox()
Returns
Type | Description |
---|---|
Rect | the crop box for this page. The page dimensions are specified in user space coordinates. The crop box is the region of the page to display and print. |
Remarks
this method is equivalent to GetBox(Page::e_crop)
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetDefaultMatrix()
Gets the default matrix.
Declaration
public Matrix2D GetDefaultMatrix()
Returns
Type | Description |
---|---|
Matrix2D | the matrix that transforms user space coordinates to rotated and cropped coordinates. The origin of this space is the bottom-left of the rotated, cropped page. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetDefaultMatrix(bool)
Gets the default matrix.
Declaration
public Matrix2D GetDefaultMatrix(bool flip)
Parameters
Type | Name | Description |
---|---|---|
bool | flip | 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. |
Returns
Type | Description |
---|---|
Matrix2D | the matrix that transforms user space coordinates to rotated and cropped coordinates. The origin of this space is the bottom-left of the rotated, cropped page. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetDefaultMatrix(bool, Box)
Gets the default matrix.
Declaration
public Matrix2D GetDefaultMatrix(bool flip, Page.Box region)
Parameters
Type | Name | Description |
---|---|---|
bool | flip | 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. |
Page.Box | region | 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. |
Returns
Type | Description |
---|---|
Matrix2D | the matrix that transforms user space coordinates to rotated and cropped coordinates. The origin of this space is the bottom-left of the rotated, cropped page. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetDefaultMatrix(bool, Box, Rotate)
Gets the default matrix.
Declaration
public Matrix2D GetDefaultMatrix(bool flip, Page.Box region, Page.Rotate rot)
Parameters
Type | Name | Description |
---|---|---|
bool | flip | 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. |
Page.Box | region | 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. |
Page.Rotate | rot | the rot_type |
Returns
Type | Description |
---|---|
Matrix2D | the matrix that transforms user space coordinates to rotated and cropped coordinates. The origin of this space is the bottom-left of the rotated, cropped page. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetIndex()
Gets the index.
Declaration
public int GetIndex()
Returns
Type | Description |
---|---|
int | the Page number indication the position of this Page in document's page sequence. Document's page sequence is indexed from 1. Page number 0 means that the page is not part of document's page sequence or that the page is not valid. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetMediaBox()
Gets the media box.
Declaration
public Rect GetMediaBox()
Returns
Type | Description |
---|---|
Rect | the media box for this page. The page dimensions are specified in user space coordinates. The media box defines the boundaries of the physical medium on which the page is to be printed. It may include any extended area surrounding the finished page for bleed, printing marks, or other such purposes. |
Remarks
this method is equivalent to GetBox(Page::e_media)
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetNumAnnots()
Gets the number of annotations on a page. Widget annotations (form fields) are included in the count.
Declaration
public int GetNumAnnots()
Returns
Type | Description |
---|---|
int | number of annotations on a page. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetPageHeight()
Gets the page height.
Declaration
public double GetPageHeight()
Returns
Type | Description |
---|---|
double | the height for the given page region/box taking into account page rotation attribute (i.e. /Rotate entry in page dictionary). |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetPageHeight(Box)
Gets the page height.
Declaration
public double GetPageHeight(Page.Box region)
Parameters
Type | Name | Description |
---|---|---|
Page.Box | region | the box_type |
Returns
Type | Description |
---|---|
double | the page height |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetPageWidth()
Gets the page width.
Declaration
public double GetPageWidth()
Returns
Type | Description |
---|---|
double | the width for the given page region/box taking into account page rotation attribute (i.e. /Rotate entry in page dictionary). |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetPageWidth(Box)
Gets the page width.
Declaration
public double GetPageWidth(Page.Box region)
Parameters
Type | Name | Description |
---|---|---|
Page.Box | region | the box_type |
Returns
Type | Description |
---|---|
double | the page width |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetResourceDict()
Gets the resource dictionary.
Declaration
public Obj GetResourceDict()
Returns
Type | Description |
---|---|
Obj | a pointer to the page resource dictionary. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetRotation()
Gets the rotation.
Declaration
public Page.Rotate GetRotation()
Returns
Type | Description |
---|---|
Page.Rotate | the rotation value for this page. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetSDFObj()
Gets the page dictionary.
Declaration
public Obj GetSDFObj()
Returns
Type | Description |
---|---|
Obj | the object to the underlying SDF/Cos object. |
GetThumb()
Get the thumbnail object.
Declaration
public Obj GetThumb()
Returns
Type | Description |
---|---|
Obj | Object representing the Image thumbnail. |
GetTriggerAction(EventType)
Get the Action associated with the selected Page Trigger event
Declaration
public Obj GetTriggerAction(Page.EventType trigger)
Parameters
Type | Name | Description |
---|---|---|
Page.EventType | trigger | the type of trigger event to get |
Returns
Type | Description |
---|---|
Obj | The action Obj if present, otherwise NULL |
GetUserUnitSize()
Gets 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.
Declaration
public double GetUserUnitSize()
Returns
Type | Description |
---|---|
double | the UserUnit value for the page. If the key is not present in the page dictionary the default of 1.0 is returned. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetVisibleContentBox()
The bounding box is defined as the smallest rectangle that includes all the visible content on the page.
Declaration
public Rect GetVisibleContentBox()
Returns
Type | Description |
---|---|
Rect | the bounding box for this page. The page dimensions are specified in user space coordinates. |
HasTransition()
Tests whether this page has a transition.
Declaration
public bool HasTransition()
Returns
Type | Description |
---|---|
bool | true, if successful |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
IsValid()
Checks if is valid.
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
bool | true if this is a valid (non-null) page, false otherwise. If the function returns false the underlying SDF/Cos object is null or is not valid. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
RotationToDegree(Rotate)
Convert a rotation to a number.
Declaration
public static int RotationToDegree(Page.Rotate r)
Parameters
Type | Name | Description |
---|---|---|
Page.Rotate | r | rotation to convert to number |
Returns
Type | Description |
---|---|
int | one of four numbers; 0, 90, 180 or 270. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Scale(double)
A utility method used to scale physical dimensions of the page including all page content.
Declaration
public void Scale(double sc)
Parameters
Type | Name | Description |
---|---|---|
double | sc | 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. |
Remarks
Unlike SetUserUnitSize(unit_size) which is only supported in PDF 1.6 (i.e. Acrobat 7) and above, page.Scale(sc) supports all PDF versions.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Set(Page)
Sets the page to given Page
object
Declaration
public void Set(Page p)
Parameters
Type | Name | Description |
---|---|---|
Page | p | a given |
SetBox(Box, Rect)
Sets the specified box
Declaration
public void SetBox(Page.Box type, Rect box)
Parameters
Type | Name | Description |
---|---|---|
Page.Box | type | The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. |
Rect | box | A rectangle specifying the coordinates to set for the box. The coordinates are specified in user space units. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetCropBox(Rect)
Sets the crop box for this page. The crop box is the region of the page to display and print.
Declaration
public void SetCropBox(Rect box)
Parameters
Type | Name | Description |
---|---|---|
Rect | box | the new crop box for this page. The page dimensions are specified in user space coordinates. The crop box defines the region to which the contents of the page are to be clipped (cropped) when displayed or printed. |
Remarks
this method is equivalent to SetBox(Page::e_crop)
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetMediaBox(Rect)
Sets the media box for this page.
Declaration
public void SetMediaBox(Rect box)
Parameters
Type | Name | Description |
---|---|---|
Rect | box | the new media box for this page. The page dimensions are specified in user space coordinates. The media box defines the boundaries of the physical medium on which the page is to be printed. It may include any extended area surrounding the finished page for bleed, printing marks, or other such purposes. |
Remarks
this method is equivalent to SetBox(Page::e_media)
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetRotation(Rotate)
Sets the rotation value for this page.
Declaration
public void SetRotation(Page.Rotate angle)
Parameters
Type | Name | Description |
---|---|---|
Page.Rotate | angle | the new rotation |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetUserUnitSize(double)
Sets the UserUnit value for a page.
Declaration
public void SetUserUnitSize(double unit_size)
Parameters
Type | Name | Description |
---|---|---|
double | unit_size | A positive number giving the size of default user space units, in multiples of 1/72 inch. |
Remarks
This is a PDF 1.6 feature. See the implementation note 171 in PDF Reference for details.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SubtractRotations(Rotate, Rotate)
Rotate r0 counter clockwise by r1.
Declaration
public static Page.Rotate SubtractRotations(Page.Rotate r0, Page.Rotate r1)
Parameters
Type | Name | Description |
---|---|---|
Page.Rotate | r0 | r0 first rotation. |
Page.Rotate | r1 | r1 second rotation. |
Returns
Type | Description |
---|---|
Page.Rotate | returns r0 - r1 |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
op_Assign(Page)
Assignment operator
Declaration
public Page op_Assign(Page r)
Parameters
Type | Name | Description |
---|---|---|
Page | r | a given |
Returns
Type | Description |
---|---|
Page | a |