PDFPage¶
Namespace: O2S.Components.PDF4NET
Defines a PDF page.
Inheritance Object → PDFContentStreamContainer → PDFPage
Constructors¶
PDFPage()¶
Initializes a new PDFPage object.
PDFPage(PDFPageSize)¶
Initializes a new PDFPage object.
Parameters
pageSize PDFPageSize
Initial page size.
PDFPage(PDFPage)¶
Initializes a new PDFPage object.
Parameters
src PDFPage
Properties¶
Annotations¶
Gets the annotations.
Property Value
PDFAnnotationCollection
The list of annotations associated with the page.
ArtBox¶
Gets or sets the art box.
Property Value
PDFStandardRectangle
A PDFStandardRectangle, 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
BleedBox¶
Gets or sets the bleed box.
Property Value
PDFStandardRectangle
A PDFStandardRectangle, 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.
Canvas¶
Gets the page canvas.
Property Value
PDFPageCanvas
The page canvas surface.
CloseAction¶
Gets or sets the page close action.
Property Value
PDFAction
An action to be performed when the page is closed
(for example, when the user navigates to the next or previous page, or follows
a link annotation or outline item).
CosDictionary¶
Gets the COS dictionary asssociated with this object.
Property Value
PDFCosDictionary
The internal COS dictionary.
Remarks
Incorrect manipulation of the information in the COS dictionary can lead to invalid PDF files.
CropBox¶
Gets or sets the crop box.
Property Value
PDFStandardRectangle
A PDFStandardRectangle, expressed in default user space units,
defining the visible region of default user space.
Document¶
Gets the PDF document.
Property Value
PDFFixedDocument
The document in which this page is included.
Fields¶
Gets the form fields.
Property Value
PDFFieldCollection
The list of form fields associated with the page.
Group¶
Gets or sets the page group.
Property Value
PDFGroupXObject
A PDFGroupXObject object that shall specify the attributes of the page's page group for use in the transparent imaging model.
Height¶
Gets or sets the visual page height.
Property Value
Double
The visual height of the page.
Remarks
The visual height is the height of the page as it is seen on the display. It is always measured on vertical no matter the page rotation.
MediaBox¶
Gets or sets the media box.
Property Value
PDFStandardRectangle
A PDFStandardRectangle, expressed in default user space units,
defining the boundaries of the physical medium on which the page is intended to be
displayed or printed.
OpenAction¶
Gets or sets the page open action.
Property Value
PDFAction
An action to be performed when the page is opened
(for example, when the user navigates to it from the next or previous page or by means
of a link annotation or outline item).
OptionalContentGroups¶
Gets the list of optional content groups included in the page content.
Property Value
PDFOptionalContentGroupCollection
The list of optional content groups included in the page content
Remarks
This collection is filled automatically with the optional content groups drawn on the page, either when page content is created or when a page is loaded from a source file.
PageSize¶
Gets or sets the PDF page size to a predefined value.
Property Value
PDFPageSize
A PDFPageSize object that specifies a predefined page size.
Remarks
The value returned by this property is matched against predefined page sizes within a certain margin (PDFPageSize.Delta) so the Width and Height properties of the returned object might not match the actual page Width and Height.
Rotation¶
Gets or sets the rotation angle.
Property Value
Int32
The number of degrees by which the page should be rotated clockwise when displayed or printed.
Exceptions
ArgumentOutOfRangeException
Thrown when the value being set is not one of the accepted values.
Remarks
The accepted values for this property are 0, 90, 180 and 270 degrees.
TabOrder¶
Gets or sets the annotations tab order.
Property Value
PDFPageTabOrder
A PDFPageTabOrder enumeration member specifying the tab order that shall be used for annotations on the page.
TrimBox¶
Gets or sets the trim box.
Property Value
PDFStandardRectangle
A PDFStandardRectangle, expressed in default user space units,
defining the intended dimensions of the finished page after trimming.
UserUnit¶
Gets or sets the page user unit.
Property Value
Double
A positive number that shall give the size of default user space units, in multiples of 1/72 inch.
Exceptions
ArgumentOutOfRangeException
Thrown when the value being set is negative or zero.
Viewports¶
Gets or sets the page viewports.
Property Value
PDFViewportCollection
A collection of viewports defined on the page.
VisibleBox¶
Gets the box that defines the actual visible area of the page.
Property Value
PDFStandardRectangle
A PDFStandardRectangle, expressed in default user space units, defining the actual visible region of default user space.
Width¶
Gets or sets the visual page width.
Property Value
Double
The visual width of the page.
Remarks
The visual width is the width of the page as it is seen on the display. It is always measured on horizontal no matter the page rotation.
XmpMetadata¶
Gets or sets the XMP page metadata.
Property Value
PDFXmpMetadata
The XMP page metadata.
Methods¶
ConvertDisplayPointToStandardPoint(PDFPoint)¶
Converts a point from the visual coordinate system (origin of coordinate system in top left corner of visual page area) to standard PDF coordinate system (origin of coordinate system in bottom left corner of page media box).
Parameters
point PDFPoint
The point in visual coordinates.
Returns
PDFPoint
The point in standard PDF coodinates.
ConvertDisplayRectangleToStandardRectangle(PDFDisplayRectangle)¶
Converts a rectangle on the page from visual coordinate system (origin of coordinate system in top left corner of visual page area) to standard PDF coordinate system (origin of coordinate system in bottom left corner of page media box).
public PDFStandardRectangle ConvertDisplayRectangleToStandardRectangle(PDFDisplayRectangle visualRectangle)
Parameters
visualRectangle PDFDisplayRectangle
The rectangle in visual coordinates.
Returns
PDFStandardRectangle
The rectangle in standard PDF coordinates.
ConvertStandardPointToDisplayPoint(PDFPoint)¶
Converts a point from standard PDF coordinate system (origin of coordinate system in bottom left corner of page media box) to visual coordinate system (origin of coordinate system in top left corner of visual page area).
Parameters
point PDFPoint
The point in standard PDF coordinates.
Returns
PDFPoint
The point in visual coodinates.
ConvertStandardRectangleToDisplayRectangle(PDFStandardRectangle)¶
Converts a rectangle on the page from standard PDF coordinate system (origin of coordinate system in bottom left corner of page media box) to visual coordinate system (origin of coordinate system in top left corner of visual page area).
public PDFDisplayRectangle ConvertStandardRectangleToDisplayRectangle(PDFStandardRectangle standardRectangle)
Parameters
standardRectangle PDFStandardRectangle
The rectangle in standard PDF coordinates.
Returns
PDFDisplayRectangle
The rectangle in visual coordinates.
GetPageFonts(Boolean, Boolean)¶
Gets the set of fonts included in this page.
public HashSet<PDFCosDictionary> GetPageFonts(bool includeEmbeddedFont, bool includeNonEmbeddedFonts)
Parameters
includeEmbeddedFont Boolean
True if the set should include the embedded fonts.
includeNonEmbeddedFonts Boolean
True if the set should include the non-embedded fonts.
Returns
HashSet<PDFCosDictionary>
A set of PDFCosDictionary objects representing the fonts used by this page.
Remarks
This method examines the fonts included in page's resources dictionary. It is possible that not all the fonts are actually used on the page.
LoadGraphics(Boolean)¶
Loads the page canvas from the source PDF file.
Parameters
enableAllOperations Boolean
If true then all page content streams are loaded so that all operations that process the page content
(add new content, text search, redaction, page transforms, etc) can be performed with success. If false then only adding new content to the page is supported.
Remarks
When a PDF file is opened in incremental update mode, the page canvas is not loaded if not specified explicitly.
This method allows to load the page canvas on demand only for required pages.
Note: This method can be used only when the document has been loaded from a stream and the stream has been kept open, otherwise an exception will be thrown.
Save()¶
Saves the PDF page.
Remarks
The page must be included in a document and the save procedure must be already initiated by a PDFFixedDocument.BeginSave(Stream) call.
SaveCanvas()¶
Saves the page canvas.
Remarks
The page canvas can be composed internally of multiple fragments. If you are working with large vector graphics, such as maps, then
you can split the page canvas in fragments and save each fragmment as soon as it is done in order to reduce memory
consumption. A graphics fragment is automatically created when PDFPageCanvas.Compress() method is called.
The page must be included in a document and the save procedure must be already initiated by a PDFFixedDocument.BeginSave(Stream) call.
SaveImages()¶
Saves the images drawn on the PDF page.
Remarks
The page must be included in a document and the save procedure must be already initiated by a PDFFixedDocument.BeginSave(Stream) call.
SetCanvasPosition(PDFPageCanvasPosition)¶
Sets the position of the page canvas relative to existing page content.
Parameters
canvasPosition PDFPageCanvasPosition
Position of the page canvas.
Remarks
If the page is newly created this method has no effect since there is no previous content. If the page has been extracted from a PDF file or has been created by loading a PDF file into a PDFFixedDocument then the page canvas can be under the existing page content or on top of existing page content (default).