Class XpsDocument

XpsDocument class

Class incapsulating the main entity of XPS document that provides manipulation methods for any XPS element.

public sealed class XpsDocument : Document, IDisposable

Constructors

NameDescription
XpsDocument()Creates empty XPS document with default page size.
XpsDocument(string)Opens an existing XPS document located at the path.
XpsDocument(Stream, LoadOptions)Loads an existing document stored in the stream as XPS document.
XpsDocument(string, LoadOptions)Opens an existing document located at the path as XPS document.

Properties

NameDescription
ActiveDocument { get; }Gets the active document number.
ActivePage { get; }Gets the active page number within the active document.
DocumentCount { get; }Returns the number of documents inside the XPS package.
JobPrintTicket { get; set; }Returns/sets document’s job print ticket
Page { get; }Returns an XpsPage instance for active page.
PageCount { get; }Returns the number of pages in the active document.
TotalPageCount { get; }Returns total number of pages in all documents inside XPS document.

Methods

NameDescription
Add<T>(T)Adds a content element (Canvas, Path or Glyphs)
AddCanvas()Adds a new canvas to the active page.
AddDocument(bool)Adds an empty document with default page size.
AddDocument(float, float, bool)Adds an empty document with the first page dimensions width and height.
AddGlyphs(XpsFont, float, float, float, string)Adds new glyphs to the active page.
AddGlyphs(string, float, FontStyle, float, float, string)Adds new glyphs to the active page.
AddOutlineEntry(string, int, XpsHyperlinkTarget)Adds an outline entry to the document.
AddPage(bool)Adds an empty page to the document with default page size.
AddPage(XpsPage, bool)Adds a page to the document.
AddPage(float, float, bool)Adds an empty page to the document with specified width and height.
AddPath(XpsPathGeometry)Adds a new path to the active page.
CreateArcSegment(PointF, SizeF, float, bool, XpsSweepDirection, bool)Creates a new elliptical arc segment.
CreateCanvas()Creates a new canvas.
CreateColor(Color)Creates a new color.
CreateColor(string, params float[])Creates a new color in ICC based color space.
CreateColor(XpsIccProfile, params float[])Creates a new color in ICC based color space.
CreateColor(float, float, float)Creates a new color in scRGB color space.
CreateColor(int, int, int)Creates a new color in sRGB color space.
CreateColor(float, float, float, float)Creates a new color in scRGB color space.
CreateColor(int, int, int, int)Creates a new color in sRGB color space.
CreateFont(Stream)Creates a new TrueType font resource out of stream.
CreateFont(string, FontStyle)Creates a new TrueType font resource.
CreateGlyphs(XpsFont, float, float, float, string)Creates new glyphs.
CreateGlyphs(string, float, FontStyle, float, float, string)Creates new glyphs.
CreateGradientStop(Color, float)Creates a new gradient stop.
CreateGradientStop(XpsColor, float)Creates a new gradient stop.
CreateIccProfile(Stream)Creates a new ICC profile resource out of stream.
CreateIccProfile(string)Creates a new ICC profile resource out of ICC profile file located at the iccProfilePath.
CreateImage(Stream)Creates a new image resource out of stream.
CreateImage(string)Creates a new image resource out of image file located at the imagePath.
CreateImageBrush(string, RectangleF, RectangleF)Creates a new image brush.
CreateImageBrush(XpsImage, RectangleF, RectangleF)Creates a new image brush.
CreateLinearGradientBrush(PointF, PointF)Creates a new linear gradient brush.
CreateLinearGradientBrush(List<XpsGradientStop>, PointF, PointF)Creates a new linear gradient brush.
CreateMatrix(float, float, float, float, float, float)Creates a new affine transformation matrix.
CreatePath(XpsPathGeometry)Creates a new path.
CreatePathFigure(PointF, bool)Creates a new path figure.
CreatePathFigure(PointF, List<XpsPathSegment>, bool)Creates a new path figure.
CreatePathGeometry()Creates a new path geometry.
CreatePathGeometry(List<XpsPathFigure>)Creates a new path geometry with specified list of path figures.
CreatePathGeometry(string)Creates a new path geometry specified with abbreviated form.
CreatePolyBezierSegment(PointF[], bool)Creates a new set of cubic Bézier curves.
CreatePolyLineSegment(PointF[], bool)Creates a new polygonal drawing containing an arbitrary number of individual vertices.
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.
CreateRadialGradientBrush(PointF, PointF, float, float)Creates a new radial gradient brush.
CreateRadialGradientBrush(List<XpsGradientStop>, PointF, PointF, float, float)Creates a new radial gradient brush.
CreateSolidColorBrush(Color)Creates a new solid color brush.
CreateSolidColorBrush(XpsColor)Creates a new solid color brush.
CreateVisualBrush(XpsContentElement, RectangleF, RectangleF)Creates a new visual brush.
Dispose()Disposes the instance.
GetDocumentPrintTicket(int)Returns the print ticket of the document indexed by documentIndex.
GetPagePrintTicket(int, int)Returns the print ticket of the page indexed by pageIndex in the document indexed by documentIndex.
Insert<T>(int, T)Inserts an element (Canvas, Path or Glyphs) to the active page at index position.
InsertCanvas(int)Inserts a new canvas to the active page at index position.
InsertDocument(int, bool)Inserts an empty document with default page size at index position.
InsertDocument(int, float, float, bool)Inserts an empty document with the first page dimensions width and height at index position.
InsertGlyphs(int, XpsFont, float, float, float, string)Inserts new glyphs to the active page at index position.
InsertGlyphs(int, string, float, FontStyle, float, float, string)Inserts new glyphs to the active page at index position.
InsertPage(int, bool)Inserts an empty page to the document with default page size at index position.
InsertPage(int, XpsPage, bool)Inserts a page to the document at index position.
InsertPage(int, float, float, bool)Inserts an empty page to the document with specified width and height at index position.
InsertPath(int, XpsPathGeometry)Inserts a new path to the active page at index position.
Merge(string[], Stream)Merging several XPS files to one XPS document.
Merge(string[], Device, SaveOptions)Merging XPS documents to PDF using the Device instance.
Remove<T>(T)Removes an element from the active page.
RemoveAt(int)Removes an element at index position from the active page.
RemoveDocumentAt(int)Removes a document at index position.
RemovePage(XpsPage)Removes a page from the document.
RemovePageAt(int)Removes a page from the document at index position.
Save(Stream)Saves XPS document to stream.
Save(string)Saves XPS document to XPS file located at the path.
override Save(Device, SaveOptions)Saves the document using the Device instance.
SelectActiveDocument(int)Selects an active document for editing.
SelectActivePage(int)Selects an active document page for editing.
SetDocumentPrintTicket(int, DocumentPrintTicket)Links the printTicket to the document indexed by documentIndex.
SetPagePrintTicket(int, int, PagePrintTicket)Links the printTicket to the page indexed by pageIndex in the document indexed by documentIndex.

See Also