Class PageAPI

Class PageAPI

Namespace: Aspose.Page.XPS.Features.EventBasedModifications
Assembly: Aspose.Page.dll (25.1.2)

The Page element modification API.

public class PageAPI : IModificationAPI

Inheritance

objectPageAPI

Implements

IModificationAPI

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Properties

Height

Returns/sets the height of the page, expressed as a real number in units of the effective coordinate space.

public float Height { get; set; }

Property Value

float

PageCount

Returns the number of pages in the active document.

public int PageCount { get; }

Property Value

int

TotalPageCount

Returns the total number of pages in all documents inside XPS document.

public int TotalPageCount { get; }

Property Value

int

Utils

Gets the object that provides utilities beyond the formal XPS manipulation API.

public DocumentUtils Utils { get; }

Property Value

DocumentUtils

Width

Returns/sets the width of the page, expressed as a real number in units of the effective coordinate space.

public float Width { get; set; }

Property Value

float

Methods

Add<t>(T)

Adds a content element (Canvas, Path, or Glyphs).

public T Add<t>(T element) where T : XpsContentElement

Parameters

element T

Element to be added.

Returns

T

Added element.

Type Parameters

T

The type of the element.

AddCanvas()

Adds a new canvas to the page.

public XpsCanvas AddCanvas()

Returns

XpsCanvas

Added canvas.

AddGlyphs(string, float, FontStyle, float, float, string)

Adds new glyphs to the page.

public XpsGlyphs AddGlyphs(string fontFamily, float fontRenderingEmSize, FontStyle fontStyle, float originX, float originY, string unicodeString)

Parameters

fontFamily string

Font family.

fontRenderingEmSize float

Font size.

fontStyle FontStyle

Font style.

originX float

Glyphs origin X coordinate.

originY float

Glyphs origin Y coordinate.

unicodeString string

String to be printed.

Returns

XpsGlyphs

Added glyphs.

AddGlyphs(XpsFont, float, float, float, string)

Adds new glyphs to the page.

public XpsGlyphs AddGlyphs(XpsFont font, float fontRenderingEmSize, float originX, float originY, string unicodeString)

Parameters

font XpsFont

Font resource.

fontRenderingEmSize float

Font size.

originX float

Glyphs origin X coordinate.

originY float

Glyphs origin Y coordinate.

unicodeString string

String to be printed.

Returns

XpsGlyphs

Added glyphs.

AddOutlineEntry(string, int, int)

Adds an outline entry to the document.

public void AddOutlineEntry(string description, int outlineLevel, int targetPageNumber)

Parameters

description string

The entry description.

outlineLevel int

The outline level.

targetPageNumber int

The target page number.

AddPath(XpsPathGeometry)

Adds a new path to the page.

public XpsPath AddPath(XpsPathGeometry data)

Parameters

data XpsPathGeometry

The geometry of the path.

Returns

XpsPath

Added path.

CreateArcSegment(PointF, SizeF, float, bool, XpsSweepDirection, bool)

Creates a new elliptical arc segment.

public XpsArcSegment CreateArcSegment(PointF point, SizeF size, float rotationAngle, bool isLargeArc, XpsSweepDirection sweepDirection, bool isStroked = true)

Parameters

point PointF

The endpoint of the elliptical arc.

size SizeF

The x and y radius of the elliptical arc as an x,y pair.

rotationAngle float

Indicates how the ellipse is rotated relative to the current coordinate system.

isLargeArc bool

Determines whether the arc is drawn with a sweep of 180 or greater.

sweepDirection XpsSweepDirection

The direction in which the arc is drawn.

isStroked bool

Specifies whether the stroke for this segment of the path is drawn.

Returns

XpsArcSegment

New elliptical arc segment.

CreateCanvas()

Creates a new canvas.

public XpsCanvas CreateCanvas()

Returns

XpsCanvas

New canvas.

CreateColor(Color)

Creates a new color.

public XpsColor CreateColor(Color color)

Parameters

color Color

A native color instance for RGB color.

Returns

XpsColor

New color.

CreateColor(int, int, int, int)

Creates a new color in sRGB color space.

public XpsColor CreateColor(int a, int r, int g, int b)

Parameters

a int

The alpha color component.

r int

The red color component.

g int

The green color component.

b int

The blue color component.

Returns

XpsColor

New color.

CreateColor(int, int, int)

Creates a new color in sRGB color space.

public XpsColor CreateColor(int r, int g, int b)

Parameters

r int

The red color component.

g int

The green color component.

b int

The blue color component.

Returns

XpsColor

New color.

CreateColor(float, float, float, float)

Creates a new color in scRGB color space.

public XpsColor CreateColor(float a, float r, float g, float b)

Parameters

a float

The alpha color component.

r float

The red color component.

g float

The green color component.

b float

The blue color component.

Returns

XpsColor

New color.

CreateColor(float, float, float)

Creates a new color in scRGB color space.

public XpsColor CreateColor(float r, float g, float b)

Parameters

r float

The red color component.

g float

The green color component.

b float

The blue color component.

Returns

XpsColor

New color.

CreateColor(string, params float[])

Creates a new color in ICC based color space.

public XpsColor CreateColor(string path, params float[] components)

Parameters

path string

The path to the ICC profile.

components float[]

Color components.

Returns

XpsColor

New color.

CreateColor(XpsIccProfile, params float[])

Creates a new color in ICC based color space.

public XpsColor CreateColor(XpsIccProfile iccProfile, params float[] components)

Parameters

iccProfile XpsIccProfile

The ICC profile resource.

components float[]

Color components.

Returns

XpsColor

New color.

CreateGlyphs(string, float, FontStyle, float, float, string)

Creates new glyphs.

public XpsGlyphs CreateGlyphs(string fontFamily, float fontRenderingEmSize, FontStyle fontStyle, float originX, float originY, string unicodeString)

Parameters

fontFamily string

Font family.

fontRenderingEmSize float

Font size.

fontStyle FontStyle

Font style.

originX float

Glyphs origin X coordinate.

originY float

Glyphs origin Y coordinate.

unicodeString string

String to be printed.

Returns

XpsGlyphs

New glyphs.

CreateGlyphs(XpsFont, float, float, float, string)

Creates new glyphs.

public XpsGlyphs CreateGlyphs(XpsFont font, float fontRenderingEmSize, float originX, float originY, string unicodeString)

Parameters

font XpsFont

Font resource.

fontRenderingEmSize float

Font size.

originX float

Glyphs origin X coordinate.

originY float

Glyphs origin Y coordinate.

unicodeString string

String to be printed.

Returns

XpsGlyphs

New glyphs.

CreateGradientStop(XpsColor, float)

Creates a new gradient stop.

public XpsGradientStop CreateGradientStop(XpsColor color, float offset)

Parameters

color XpsColor

The gradient stop color.

offset float

The gradient offset.

Returns

XpsGradientStop

New gradient stop.

CreateGradientStop(Color, float)

Creates a new gradient stop.

public XpsGradientStop CreateGradientStop(Color color, float offset)

Parameters

color Color

The gradient stop color.

offset float

The gradient offset.

Returns

XpsGradientStop

New gradient stop.

CreateImageBrush(XpsImage, RectangleF, RectangleF)

Creates a new image brush.

public XpsImageBrush CreateImageBrush(XpsImage image, RectangleF viewbox, RectangleF viewport)

Parameters

image XpsImage

An image resource.

viewbox RectangleF

The position and dimensions of the brush’s source content.

viewport RectangleF

The region in the containing coordinate space of the prime brush tile that is (possibly repeatedly) applied to fill the region to which the brush is applied

Returns

XpsImageBrush

New image brush.

CreateImageBrush(string, RectangleF, RectangleF)

Creates a new image brush.

public XpsImageBrush CreateImageBrush(string imagePath, RectangleF viewbox, RectangleF viewport)

Parameters

imagePath string

The path to the image to take as a brush tile.

viewbox RectangleF

The position and dimensions of the brush’s source content.

viewport RectangleF

The region in the containing coordinate space of the prime brush tile that is (possibly repeatedly) applied to fill the region to which the brush is applied

Returns

XpsImageBrush

New image brush.

CreateLinearGradientBrush(List<xpsgradientstop>, PointF, PointF)

Creates a new linear gradient brush.

public XpsLinearGradientBrush CreateLinearGradientBrush(List<xpsgradientstop> gradientStops, PointF startPoint, PointF endPoint)

Parameters

gradientStops List<XpsGradientStop&gt;

The list of gradient stops.

startPoint PointF

The starting point of the linear gradient.

endPoint PointF

The end point of the linear gradient.

Returns

XpsLinearGradientBrush

New linear gradient brush.

CreateLinearGradientBrush(PointF, PointF)

Creates a new linear gradient brush.

public XpsLinearGradientBrush CreateLinearGradientBrush(PointF startPoint, PointF endPoint)

Parameters

startPoint PointF

The starting point of the linear gradient.

endPoint PointF

The end point of the linear gradient.

Returns

XpsLinearGradientBrush

New linear gradient brush.

CreateMatrix(float, float, float, float, float, float)

Creates a new affine transformation matrix.

public XpsMatrix CreateMatrix(float m11, float m12, float m21, float m22, float m31, float m32)

Parameters

m11 float

Element 11.

m12 float

Element 12.

m21 float

Element 21.

m22 float

Element 22.

m31 float

Element 31.

m32 float

Element 32.

Returns

XpsMatrix

New affine transformation matrix.

CreatePath(XpsPathGeometry)

Creates a new path.

public XpsPath CreatePath(XpsPathGeometry data)

Parameters

data XpsPathGeometry

The geometry of the path.

Returns

XpsPath

New path.

CreatePathFigure(PointF, bool)

Creates a new path figure.

public XpsPathFigure CreatePathFigure(PointF startPoint, bool isClosed = false)

Parameters

startPoint PointF

The starting point for the first segment of the path figure.

isClosed bool

Specifies whether the path is closed. If set to true, the stroke is drawn “closed”, that is, the last point in the last segment of the path figure is connected with the point specified in the StartPoint attribute, otherwise the stroke is drawn “open”, and the last point is not connected to the start point. Only applicable if the path figure is used in a Path element that specifies a stroke.

Returns

XpsPathFigure

New path figure.

CreatePathFigure(PointF, List<xpspathsegment>, bool)

Creates a new path figure.

public XpsPathFigure CreatePathFigure(PointF startPoint, List<xpspathsegment> segments, bool isClosed = false)

Parameters

startPoint PointF

The starting point for the first segment of the path figure.

segments List<XpsPathSegment&gt;

List of path segments.

isClosed bool

Specifies whether the path is closed. If set to true, the stroke is drawn “closed”, that is, the last point in the last segment of the path figure is connected with the point specified in the StartPoint attribute, otherwise the stroke is drawn “open”, and the last point is not connected to the start point. Only applicable if the path figure is used in a Path element that specifies a stroke.

Returns

XpsPathFigure

New path figure.

CreatePathGeometry(string)

Creates a new path geometry specified with abbreviated form.

public XpsPathGeometry CreatePathGeometry(string abbreviatedGeometry)

Parameters

abbreviatedGeometry string

Abbreviated form of path geometry.

Returns

XpsPathGeometry

New path geometry.

CreatePathGeometry()

Creates a new path geometry.

public XpsPathGeometry CreatePathGeometry()

Returns

XpsPathGeometry

New path geometry.

CreatePathGeometry(List<xpspathfigure>)

Creates a new path geometry with specified list of path figures.

public XpsPathGeometry CreatePathGeometry(List<xpspathfigure> pathFigures)

Parameters

pathFigures List<XpsPathFigure&gt;

List of path figures.

Returns

XpsPathGeometry

New path geometry.

CreatePolyBezierSegment(PointF[], bool)

Creates a new set of cubic Bézier curves.

public XpsPolyBezierSegment CreatePolyBezierSegment(PointF[] points, bool isStroked = true)

Parameters

points PointF[]

Control points for multiple Bézier segments.

isStroked bool

Specifies whether the stroke for this segment of the path is drawn.

Returns

XpsPolyBezierSegment

New cubic Bézier curves segment.

CreatePolyLineSegment(PointF[], bool)

Creates a new polygonal drawing containing an arbitrary number of individual vertices.

public XpsPolyLineSegment CreatePolyLineSegment(PointF[] points, bool isStroked = true)

Parameters

points PointF[]

A set of coordinates for the multiple segments that define the poly line segment.

isStroked bool

Specifies whether the stroke for this segment of the path is drawn.

Returns

XpsPolyLineSegment

New polygonal drawing segment.

CreatePolyQuadraticBezierSegment(PointF[], bool)

Creates a new set of quadratic Bézier curves from the previous point in the path figure through a set of vertices, using specified control points.

public XpsPolyQuadraticBezierSegment CreatePolyQuadraticBezierSegment(PointF[] points, bool isStroked = true)

Parameters

points PointF[]

Control points for multiple quadratic Bézier segments.

isStroked bool

Specifies whether the stroke for this segment of the path is drawn.

Returns

XpsPolyQuadraticBezierSegment

New quadratic Bézier curves segment.

CreateRadialGradientBrush(List<xpsgradientstop>, PointF, PointF, float, float)

Creates a new radial gradient brush.

public XpsRadialGradientBrush CreateRadialGradientBrush(List<xpsgradientstop> gradientStops, PointF center, PointF gradientOrigin, float radiusX, float radiusY)

Parameters

gradientStops List<XpsGradientStop&gt;

The list of gradient stops.

center PointF

The center point of the radial gradient (that is, the center of the ellipse).

gradientOrigin PointF

The origin point of the radial gradient.

radiusX float

The radius in the x dimension of the ellipse which defines the radial gradient.

radiusY float

The radius in the y dimension of the ellipse which defines the radial gradient.

Returns

XpsRadialGradientBrush

New radial gradient brush.

CreateRadialGradientBrush(PointF, PointF, float, float)

Creates a new radial gradient brush.

public XpsRadialGradientBrush CreateRadialGradientBrush(PointF center, PointF gradientOrigin, float radiusX, float radiusY)

Parameters

center PointF

The center point of the radial gradient (that is, the center of the ellipse).

gradientOrigin PointF

The origin point of the radial gradient.

radiusX float

The radius in the x dimension of the ellipse which defines the radial gradient.

radiusY float

The radius in the y dimension of the ellipse which defines the radial gradient.

Returns

XpsRadialGradientBrush

New radial gradient brush.

CreateSolidColorBrush(XpsColor)

Creates a new solid color brush.

public XpsSolidColorBrush CreateSolidColorBrush(XpsColor color)

Parameters

color XpsColor

The color for filled elements.

Returns

XpsSolidColorBrush

New solid color brush.

CreateSolidColorBrush(Color)

Creates a new solid color brush.

public XpsSolidColorBrush CreateSolidColorBrush(Color color)

Parameters

color Color

The color for filled elements.

Returns

XpsSolidColorBrush

New solid color brush.

CreateVisualBrush(XpsContentElement, RectangleF, RectangleF)

Creates a new visual brush.

public XpsVisualBrush CreateVisualBrush(XpsContentElement element, RectangleF viewbox, RectangleF viewport)

Parameters

element XpsContentElement

The XPS element (Canvas, Path or Glyphs) for Visual property od visual brush.

viewbox RectangleF

The position and dimensions of the brush’s source content.

viewport RectangleF

The region in the containing coordinate space of the prime brush tile that is (possibly repeatedly) applied to fill the region to which the brush is applied

Returns

XpsVisualBrush

New visual brush.

Insert<t>(int, T)

Inserts an element (Canvas, Path, or Glyphs) to the page at index position.

public T Insert<t>(int index, T element) where T : XpsContentElement

Parameters

index int

Position at which an element should be inserted.

element T

Element to be inserted.

Returns

T

Inserted element.

Type Parameters

T

The type of the element.

InsertCanvas(int)

Inserts a new canvas to the page at index position.

public XpsCanvas InsertCanvas(int index)

Parameters

index int

Position at which a new canvas should be inserted.

Returns

XpsCanvas

Inserted canvas.

InsertGlyphs(int, string, float, FontStyle, float, float, string)

Inserts new glyphs to the page at index position.

public XpsGlyphs InsertGlyphs(int index, string fontFamily, float fontSize, FontStyle fontStyle, float originX, float originY, string unicodeString)

Parameters

index int

Position at which new glyphs should be inserted.

fontFamily string

Font family.

fontSize float

Font size.

fontStyle FontStyle

Font style.

originX float

Glyphs origin X coordinate.

originY float

Glyphs origin Y coordinate.

unicodeString string

String to be printed.

Returns

XpsGlyphs

Inserted glyphs.

InsertGlyphs(int, XpsFont, float, float, float, string)

Inserts new glyphs to the page at index position.

public XpsGlyphs InsertGlyphs(int index, XpsFont font, float fontSize, float originX, float originY, string unicodeString)

Parameters

index int

Position at which new glyphs should be inserted.

font XpsFont

Font resource.

fontSize float

Font size.

originX float

Glyphs origin X coordinate.

originY float

Glyphs origin Y coordinate.

unicodeString string

String to be printed.

Returns

XpsGlyphs

Inserted glyphs.

InsertPath(int, XpsPathGeometry)

Inserts a new path to the page at index position.

public XpsPath InsertPath(int index, XpsPathGeometry data)

Parameters

index int

Position at which a new path should be inserted.

data XpsPathGeometry

The geometry of the path.

Returns

XpsPath

Inserted path.

Remove<t>(T)

Removes an element from the page.

public T Remove<t>(T element) where T : XpsContentElement

Parameters

element T

Element to be removed.

Returns

T

Removed element.

Type Parameters

T

The type of the element.

RemoveAt(int)

Removes an element at index position from the page.

public XpsContentElement RemoveAt(int index)

Parameters

index int

Position at which element should be removed.

Returns

XpsContentElement

Removed element. </t></t></xpsgradientstop></xpspathfigure></xpspathsegment></xpsgradientstop></t>

 English