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.
Inheritance
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFNetiOS.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(Page.Rotate, Page.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(Int32, Annot)
Adds an annotation at the specified location in a page's annotation array.
Declaration
public void AnnotInsert(int pos, Annot annot)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pos | 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 | annot | annotation to add. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
AnnotPushBack(Annot)
Adds an annotation to the end of a page's annotation array.
Declaration
public void AnnotPushBack(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot |
|
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
AnnotPushFront(Annot)
Adds an annotation to the beginning of a page's annotation array.
Declaration
public void AnnotPushFront(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot |
|
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
AnnotRemove(Annot)
Removes the given annoation from the page.
Declaration
public void AnnotRemove(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot | the annot |
Remarks
Removing the annotation invalidates the given Annot object.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
AnnotRemove(Int32)
Removes the annoation at a given location.
Declaration
public void AnnotRemove(int pos)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pos |
|
Remarks
Removing the annotation invalidates any associated Annot object.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateInternal(IntPtr, Object)
Create a new page object using native impl pointer For internal use only.
Declaration
public static Page CreateInternal(IntPtr imp, object reference)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | imp | impl pointer from PDFNet core. |
System.Object | reference |
Returns
Type | Description |
---|---|
Page |
DegreeToRotation(Int32)
Convert a number that represents rotation in degrees to a rotation enum.
Declaration
public static Page.Rotate DegreeToRotation(int r)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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 |
---|---|---|
System.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)
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.
Declaration
public void FlattenField(Field field)
Parameters
Type | Name | Description |
---|---|---|
Field | field | the field |
Remarks
An alternative approach to set the field as read only is using Field.SetFlag(Field::e_read_only, true)
method. Unlike Field.SetFlag(...), the result of FlattenField() operation can not be programatically reversed.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetAnnot(Int32)
Gets the annotation on the page.
Declaration
public Annot GetAnnot(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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(Page.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(Boolean)
Gets the default matrix.
Declaration
public Matrix2D GetDefaultMatrix(bool flip)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | 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(Boolean, Page.Box)
Gets the default matrix.
Declaration
public Matrix2D GetDefaultMatrix(bool flip, Page.Box region)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | 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(Boolean, Page.Box, Page.Rotate)
Gets the default matrix.
Declaration
public Matrix2D GetDefaultMatrix(bool flip, Page.Box region, Page.Rotate rot)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | 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 |
---|---|
System.Int32 | 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 |
---|---|
System.Int32 | 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 |
---|---|
System.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(Page.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 |
---|---|
System.Double | the page height |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetPageWidth()
Gets the page width.
Declaration
public double GetPageWidth()
Returns
Type | Description |
---|---|
System.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(Page.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 |
---|---|
System.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()
Declaration
public Obj GetThumb()
Returns
Type | Description |
---|---|
Obj |
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 |
---|---|
System.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 |
---|---|
System.Boolean | true, if successful |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
IsValid()
Checks if is valid.
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
System.Boolean | 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 |
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 |
RotationToDegree(Page.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 |
---|---|
System.Int32 | 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 |
---|---|---|
System.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(Page.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(Page.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 |
---|---|---|
System.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(Page.Rotate, Page.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 |