public class PageAPI extends Object implements IModificationAPI
The Page element modification API.
| Modifier and Type | Method and Description |
|---|---|
<T extends XpsContentElement> |
add(T element)
Adds a content element (Canvas, Path, or Glyphs)
|
XpsCanvas |
addCanvas()
Adds a new canvas to the page.
|
XpsGlyphs |
addGlyphs(String fontFamily,
float fontRenderingEmSize,
XpsFontStyle fontStyle,
float originX,
float originY,
String unicodeString)
Adds new glyphs to the page.
|
XpsGlyphs |
addGlyphs(XpsFont font,
float fontRenderingEmSize,
float originX,
float originY,
String unicodeString)
Adds new glyphs to the page.
|
void |
addOutlineEntry(String description,
int outlineLevel,
int targetPageNumber)
Adds an outline entry to the document.
|
XpsPath |
addPath(XpsPathGeometry data)
Adds a new path to the page.
|
XpsArcSegment |
createArcSegment(Point2D point,
Dimension2D size,
float rotationAngle,
boolean isLargeArc,
XpsSweepDirection sweepDirection)
Creates a new stroked elliptical arc segment.
|
XpsArcSegment |
createArcSegment(Point2D point,
Dimension2D size,
float rotationAngle,
boolean isLargeArc,
XpsSweepDirection sweepDirection,
boolean isStroked)
Creates a new elliptical arc segment.
|
XpsCanvas |
createCanvas()
Creates a new canvas.
|
XpsColor |
createColor(Color color)
Creates a new color.
|
XpsColor |
createColor(float r,
float g,
float b)
Creates a new color in scRGB color space.
|
XpsColor |
createColor(float a,
float r,
float g,
float b)
Creates a new color in scRGB color space.
|
XpsColor |
createColor(int r,
int g,
int b)
Creates a new color in sRGB color space.
|
XpsColor |
createColor(int a,
int r,
int g,
int b)
Creates a new color in sRGB color space.
|
XpsColor |
createColor(String path,
float... components)
Creates a new color in ICC based color space.
|
XpsColor |
createColor(XpsIccProfile iccProfile,
float... components)
Creates a new color in ICC based color space.
|
XpsGlyphs |
createGlyphs(String fontFamily,
float fontRenderingEmSize,
XpsFontStyle fontStyle,
float originX,
float originY,
String unicodeString)
Creates new glyphs.
|
XpsGlyphs |
createGlyphs(XpsFont font,
float fontRenderingEmSize,
float originX,
float originY,
String unicodeString)
Creates new glyphs.
|
XpsGradientStop |
createGradientStop(Color color,
float offset)
Creates a new gradient stop.
|
XpsGradientStop |
createGradientStop(XpsColor color,
float offset)
Creates a new gradient stop.
|
XpsImageBrush |
createImageBrush(String imagePath,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new image brush.
|
XpsImageBrush |
createImageBrush(XpsImage image,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new image brush.
|
XpsLinearGradientBrush |
createLinearGradientBrush(List<XpsGradientStop> gradientStops,
Point2D startPoint,
Point2D endPoint)
Creates a new linear gradient brush.
|
XpsLinearGradientBrush |
createLinearGradientBrush(Point2D startPoint,
Point2D endPoint)
Creates a new linear gradient brush.
|
XpsMatrix |
createMatrix(float m11,
float m12,
float m21,
float m22,
float m31,
float m32)
Creates a new affine transformation matrix.
|
XpsPath |
createPath(XpsPathGeometry data)
Creates a new path.
|
XpsPathFigure |
createPathFigure(Point2D startPoint)
Creates a new open path figure.
|
XpsPathFigure |
createPathFigure(Point2D startPoint,
boolean isClosed)
Creates a new path figure.
|
XpsPathFigure |
createPathFigure(Point2D startPoint,
List<XpsPathSegment> segments)
Creates a new open path figure.
|
XpsPathFigure |
createPathFigure(Point2D startPoint,
List<XpsPathSegment> segments,
boolean isClosed)
Creates a new path figure.
|
XpsPathGeometry |
createPathGeometry()
Creates a new path geometry.
|
XpsPathGeometry |
createPathGeometry(List<XpsPathFigure> pathFigures)
Creates a new path geometry with specified list of path figures.
|
XpsPathGeometry |
createPathGeometry(String abbreviatedGeometry)
Creates a new path geometry specified with abbreviated form.
|
XpsPolyBezierSegment |
createPolyBezierSegment(Point2D[] points)
Creates a new set of stroked cubic Bézier curves.
|
XpsPolyBezierSegment |
createPolyBezierSegment(Point2D[] points,
boolean isStroked)
Creates a new set of cubic Bézier curves.
|
XpsPolyLineSegment |
createPolyLineSegment(Point2D[] points)
Creates a new stroked polygonal drawing containing an arbitrary number of individual vertices.
|
XpsPolyLineSegment |
createPolyLineSegment(Point2D[] points,
boolean isStroked)
Creates a new polygonal drawing containing an arbitrary number of individual vertices.
|
XpsPolyQuadraticBezierSegment |
createPolyQuadraticBezierSegment(Point2D[] points)
Creates a new set of stroked quadratic Bézier curves from the previous point in the path figure through a set
of vertices, using specified control points.
|
XpsPolyQuadraticBezierSegment |
createPolyQuadraticBezierSegment(Point2D[] points,
boolean isStroked)
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.
|
XpsRadialGradientBrush |
createRadialGradientBrush(List<XpsGradientStop> gradientStops,
Point2D center,
Point2D gradientOrigin,
float radiusX,
float radiusY)
Creates a new radial gradient brush.
|
XpsRadialGradientBrush |
createRadialGradientBrush(Point2D center,
Point2D gradientOrigin,
float radiusX,
float radiusY)
Creates a new radial gradient brush.
|
XpsSolidColorBrush |
createSolidColorBrush(Color color)
Creates a new solid color brush.
|
XpsSolidColorBrush |
createSolidColorBrush(XpsColor color)
Creates a new solid color brush.
|
XpsVisualBrush |
createVisualBrush(XpsContentElement element,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new visual brush.
|
float |
getHeight()
Returns the height of the page, expressed as a real number
in units of the effective coordinate space.
|
int |
getPageCount()
Returns the number of pages in the active document.
|
int |
getTotalPageCount()
Returns the total number of pages in all documents inside XPS document.
|
DocumentUtils |
getUtils()
Gets the object that provides utilities beyond the formal XPS manipulation API.
|
float |
getWidth()
Returns the width of the page, expressed as a real number
in units of the effective coordinate space.
|
<T extends XpsContentElement> |
insert(int index,
T element)
Inserts an element (Canvas, Path, or Glyphs) to the page at
index position. |
XpsCanvas |
insertCanvas(int index)
Inserts a new canvas to the page at
index position. |
XpsGlyphs |
insertGlyphs(int index,
String fontFamily,
float fontSize,
XpsFontStyle fontStyle,
float originX,
float originY,
String unicodeString)
Inserts new glyphs to the page at
index position. |
XpsGlyphs |
insertGlyphs(int index,
XpsFont font,
float fontSize,
float originX,
float originY,
String unicodeString)
Inserts new glyphs to the page at
index position. |
XpsPath |
insertPath(int index,
XpsPathGeometry data)
Inserts a new path to the page at
index position. |
<T extends XpsContentElement> |
remove(T element)
Removes an element from the page.
|
XpsContentElement |
removeAt(int index)
Removes an element at
index position from the page. |
void |
setHeight(float value)
Sets the height of the page, expressed as a real number
in units of the effective coordinate space.
|
void |
setWidth(float value)
Sets the width of the page, expressed as a real number
in units of the effective coordinate space.
|
public DocumentUtils getUtils()
Gets the object that provides utilities beyond the formal XPS manipulation API.
public int getTotalPageCount()
Returns the total number of pages in all documents inside XPS document.
public int getPageCount()
Returns the number of pages in the active document.
public float getHeight()
Returns the height of the page, expressed as a real number in units of the effective coordinate space.
public void setHeight(float value)
Sets the height of the page, expressed as a real number in units of the effective coordinate space.
value - The height of the page.public float getWidth()
Returns the width of the page, expressed as a real number in units of the effective coordinate space.
public void setWidth(float value)
Sets the width of the page, expressed as a real number in units of the effective coordinate space.
value - The width of the page.public <T extends XpsContentElement> T add(T element)
Adds a content element (Canvas, Path, or Glyphs)
T - The type of the element to add.element - The element to add.public <T extends XpsContentElement> T insert(int index, T element)
Inserts an element (Canvas, Path, or Glyphs) to the page at index position.
T - The type of the element to insert.index - Position at which an element should be inserted.element - The element to insert.public <T extends XpsContentElement> T remove(T element)
Removes an element from the page.
T - The type of the element to remove.element - The element to remove.public XpsContentElement removeAt(int index)
Removes an element at index position from the page.
index - Position at which element should be removed.public XpsCanvas createCanvas()
Creates a new canvas.
public XpsCanvas addCanvas()
Adds a new canvas to the page.
public XpsCanvas insertCanvas(int index)
Inserts a new canvas to the page at index position.
index - Position at which a new canvas should be inserted.public XpsPath createPath(XpsPathGeometry data)
Creates a new path.
data - The geometry of the path.public XpsPath addPath(XpsPathGeometry data)
Adds a new path to the page.
data - The geometry of the path.public XpsPath insertPath(int index, XpsPathGeometry data)
Inserts a new path to the page at index position.
index - Position at which a new path should be inserted.data - The geometry of the path.public XpsGlyphs createGlyphs(String fontFamily, float fontRenderingEmSize, XpsFontStyle fontStyle, float originX, float originY, String unicodeString)
Creates new glyphs.
fontFamily - Font family.fontRenderingEmSize - Font size.fontStyle - Font style.originX - Glyphs origin X coordinate.originY - Glyphs origin Y coordinate.unicodeString - String to be printed.public XpsGlyphs createGlyphs(XpsFont font, float fontRenderingEmSize, float originX, float originY, String unicodeString)
Creates new glyphs.
font - Font resource.fontRenderingEmSize - Font size.originX - Glyphs origin X coordinate.originY - Glyphs origin Y coordinate.unicodeString - String to be printed.public XpsGlyphs addGlyphs(String fontFamily, float fontRenderingEmSize, XpsFontStyle fontStyle, float originX, float originY, String unicodeString)
Adds new glyphs to the page.
fontFamily - Font family.fontRenderingEmSize - Font size.fontStyle - Font style.originX - Glyphs origin X coordinate.originY - Glyphs origin Y coordinate.unicodeString - String to be printed.public XpsGlyphs insertGlyphs(int index, String fontFamily, float fontSize, XpsFontStyle fontStyle, float originX, float originY, String unicodeString)
Inserts new glyphs to the page at index position.
index - Position at which new glyphs should be inserted.fontFamily - Font family.fontSize - Font size.fontStyle - Font style.originX - Glyphs origin X coordinate.originY - Glyphs origin Y coordinate.unicodeString - String to be printed.public XpsGlyphs addGlyphs(XpsFont font, float fontRenderingEmSize, float originX, float originY, String unicodeString)
Adds new glyphs to the page.
font - Font resource.fontRenderingEmSize - Font size.originX - Glyphs origin X coordinate.originY - Glyphs origin Y coordinate.unicodeString - String to be printed.public XpsGlyphs insertGlyphs(int index, XpsFont font, float fontSize, float originX, float originY, String unicodeString)
Inserts new glyphs to the page at index position.
index - Position at which new glyphs should be inserted.font - Font resource.fontSize - Font size.originX - Glyphs origin X coordinate.originY - Glyphs origin Y coordinate.unicodeString - String to be printed.public XpsMatrix createMatrix(float m11, float m12, float m21, float m22, float m31, float m32)
Creates a new affine transformation matrix.
m11 - Element 11.m12 - Element 12.m21 - Element 21.m22 - Element 22.m31 - Element 31.m32 - Element 32.public XpsPathGeometry createPathGeometry(String abbreviatedGeometry)
Creates a new path geometry specified with abbreviated form.
abbreviatedGeometry - Abbreviated form of path geometry.public XpsPathGeometry createPathGeometry()
Creates a new path geometry.
public XpsPathGeometry createPathGeometry(List<XpsPathFigure> pathFigures)
Creates a new path geometry with specified list of path figures.
pathFigures - List of path figures.public XpsPathFigure createPathFigure(Point2D startPoint)
Creates a new open path figure.
startPoint - The starting point for the first segment of the path figure.public XpsPathFigure createPathFigure(Point2D startPoint, boolean isClosed)
Creates a new path figure.
startPoint - The starting point for the first segment of the path figure.isClosed - 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.public XpsPathFigure createPathFigure(Point2D startPoint, List<XpsPathSegment> segments)
Creates a new open path figure.
startPoint - The starting point for the first segment of the path figure.segments - List of path segments.public XpsPathFigure createPathFigure(Point2D startPoint, List<XpsPathSegment> segments, boolean isClosed)
Creates a new path figure.
startPoint - The starting point for the first segment of the path figure.segments - List of path segments.isClosed - 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.public XpsArcSegment createArcSegment(Point2D point, Dimension2D size, float rotationAngle, boolean isLargeArc, XpsSweepDirection sweepDirection)
Creates a new stroked elliptical arc segment.
point - The end point of the elliptical arc.size - The x and y radius of the elliptical arc as an x,y pair.rotationAngle - Indicates how the ellipse is rotated relative to the current coordinate system.isLargeArc - Determines whether the arc is drawn with a sweep of 180 or greater.sweepDirection - The direction in which the arc is drawn.public XpsArcSegment createArcSegment(Point2D point, Dimension2D size, float rotationAngle, boolean isLargeArc, XpsSweepDirection sweepDirection, boolean isStroked)
Creates a new elliptical arc segment.
point - The end point of the elliptical arc.size - The x and y radius of the elliptical arc as an x,y pair.rotationAngle - Indicates how the ellipse is rotated relative to the current coordinate system.isLargeArc - Determines whether the arc is drawn with a sweep of 180 or greater.sweepDirection - The direction in which the arc is drawn.isStroked - Specifies whether the stroke for this segment of the path is drawn.public XpsPolyLineSegment createPolyLineSegment(Point2D[] points)
Creates a new stroked polygonal drawing containing an arbitrary number of individual vertices.
points - A set of coordinates for the multiple segments that define the poly line segment.public XpsPolyLineSegment createPolyLineSegment(Point2D[] points, boolean isStroked)
Creates a new polygonal drawing containing an arbitrary number of individual vertices.
points - A set of coordinates for the multiple segments that define the poly line segment.isStroked - Specifies whether the stroke for this segment of the path is drawn.public XpsPolyBezierSegment createPolyBezierSegment(Point2D[] points)
Creates a new set of stroked cubic Bézier curves.
points - Control points for multiple Bézier segments.public XpsPolyBezierSegment createPolyBezierSegment(Point2D[] points, boolean isStroked)
Creates a new set of cubic Bézier curves.
points - Control points for multiple Bézier segments.isStroked - Specifies whether the stroke for this segment of the path is drawn.public XpsPolyQuadraticBezierSegment createPolyQuadraticBezierSegment(Point2D[] points)
Creates a new set of stroked quadratic Bézier curves from the previous point in the path figure through a set of vertices, using specified control points.
points - Control points for multiple quadratic Bézier segments.public XpsPolyQuadraticBezierSegment createPolyQuadraticBezierSegment(Point2D[] points, boolean isStroked)
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.
points - Control points for multiple quadratic Bézier segments.isStroked - Specifies whether the stroke for this segment of the path is drawn.public XpsSolidColorBrush createSolidColorBrush(XpsColor color)
Creates a new solid color brush.
color - The color for filled elements.public XpsSolidColorBrush createSolidColorBrush(Color color)
Creates a new solid color brush.
color - The color for filled elements.public XpsGradientStop createGradientStop(XpsColor color, float offset)
Creates a new gradient stop.
color - The gradient stop color.offset - The gradient offset.public XpsGradientStop createGradientStop(Color color, float offset)
Creates a new gradient stop.
color - The gradient stop color.offset - The gradient offset.public XpsLinearGradientBrush createLinearGradientBrush(List<XpsGradientStop> gradientStops, Point2D startPoint, Point2D endPoint)
Creates a new linear gradient brush.
gradientStops - The list of gradient stops.startPoint - The starting point of the linear gradient.endPoint - The end point of the linear gradient.public XpsLinearGradientBrush createLinearGradientBrush(Point2D startPoint, Point2D endPoint)
Creates a new linear gradient brush.
startPoint - The starting point of the linear gradient.endPoint - The end point of the linear gradient.public XpsRadialGradientBrush createRadialGradientBrush(List<XpsGradientStop> gradientStops, Point2D center, Point2D gradientOrigin, float radiusX, float radiusY)
Creates a new radial gradient brush.
gradientStops - The list of gradient stops.center - The center point of the radial gradient (that is, the center of the ellipse).gradientOrigin - The origin point of the radial gradient.radiusX - The radius in the x dimension of the ellipse which defines the radial gradient.radiusY - The radius in the y dimension of the ellipse which defines the radial gradient.public XpsRadialGradientBrush createRadialGradientBrush(Point2D center, Point2D gradientOrigin, float radiusX, float radiusY)
Creates a new radial gradient brush.
center - The center point of the radial gradient (that is, the center of the ellipse).gradientOrigin - The origin point of the radial gradient.radiusX - The radius in the x dimension of the ellipse which defines the radial gradient.radiusY - The radius in the y dimension of the ellipse which defines the radial gradient.public XpsVisualBrush createVisualBrush(XpsContentElement element, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new visual brush.
element - The XPS element (Canvas, Path, or Glyphs) for Visual property od visual brush.viewbox - The position and dimensions of the brush's source content.viewport - 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 appliedpublic XpsImageBrush createImageBrush(XpsImage image, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new image brush.
image - An image resource.viewbox - The position and dimensions of the brush's source content.viewport - 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 appliedpublic XpsImageBrush createImageBrush(String imagePath, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new image brush.
imagePath - The path to the image to take as a brush tile.viewbox - The position and dimensions of the brush's source content.viewport - 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 appliedpublic XpsColor createColor(Color color)
Creates a new color.
color - A native color instance for RGB color.public XpsColor createColor(int a, int r, int g, int b)
Creates a new color in sRGB color space.
a - The alpha color component.r - The red color component.g - The green color component.b - The blue color component.public XpsColor createColor(int r, int g, int b)
Creates a new color in sRGB color space.
r - The red color component.g - The green color component.b - The blue color component.public XpsColor createColor(float a, float r, float g, float b)
Creates a new color in scRGB color space.
a - The alpha color component.r - The red color component.g - The green color component.b - The blue color component.public XpsColor createColor(float r, float g, float b)
Creates a new color in scRGB color space.
r - The red color component.g - The green color component.b - The blue color component.public XpsColor createColor(String path, float... components)
Creates a new color in ICC based color space.
path - The path to the ICC profile.components - Color components.public XpsColor createColor(XpsIccProfile iccProfile, float... components)
Creates a new color in ICC based color space.
iccProfile - The ICC profile resource.components - Color components.public void addOutlineEntry(String description, int outlineLevel, int targetPageNumber)
Adds an outline entry to the document.
description - The entry description.outlineLevel - The outline level.targetPageNumber - The target page number.Copyright © 2025 Aspose. All Rights Reserved.