com.aspose.xps

Class XpsDocument

  • All Implemented Interfaces:
    Closeable, AutoCloseable


    public final class XpsDocument
    extends Document
    implements Closeable

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

    • Constructor Detail

      • XpsDocument

        public XpsDocument()

        Creates empty XPS document with default page size.

      • XpsDocument

        public XpsDocument(String path)
                    throws FileNotFoundException

        Opens an existing XPS document located at the path.

        Parameters:
        path - Location of the document.
        Throws:
        FileNotFoundException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
      • XpsDocument

        public XpsDocument(InputStream stream,
                           LoadOptions options)

        Loads an existing document stored in the stream as XPS document.

        Parameters:
        stream - Document stream.
        options - Document loading options.
    • Method Detail

      • selectActiveDocument

        public void selectActiveDocument(int documentNumber)

        Selects an active document for editing.

        Parameters:
        documentNumber - A document number.
        Throws:
        IllegalArgumentException - Thrown when documentNumber is out of bounds.
      • selectActivePage

        public XpsPage selectActivePage(int pageNumber)

        Selects an active document page for editing.

        Parameters:
        pageNumber - A page number.
        Returns:
        XpsPage instance for active page.
        Throws:
        IllegalArgumentException - Thrown when pageNumber is out of bounds.
      • getActiveDocument

        public int getActiveDocument()
        Returns the active document number.
        Returns:
        The int value.
      • getActivePage

        public int getActivePage()
        Returns the active page number within the active document.
        Returns:
        The int value.
      • getPage

        public XpsPage getPage()

        Returns the XpsPage instance for active page.

        Returns:
        The XpsPage instance for active page.
      • save

        public void save(String path)
                  throws FileNotFoundException

        Saves XPS document to the XPS file located at the path.

        Parameters:
        path - Location of the document.
        Throws:
        FileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason.
      • save

        public void save(OutputStream stream)

        Saves XPS document to stream.

        Parameters:
        stream - Stream XPS document to be saved into.
      • save

        public void save(Device device,
                         SaveOptions options)

        Saves the document using the Device instance.

        Specified by:
        save in class Document
        Parameters:
        device - The Device instance.
        options - Document saving options.
      • merge

        public void merge(String[] filesForMerge,
                          Device device,
                          SaveOptions options)
                   throws Exception

        Merging XPS documents using the Device instance.

        Parameters:
        filesForMerge - XPS files for merging with this document to an output device.
        device - The Device instance.
        options - Document saving options.
        Throws:
        Exception - if some critical error has occurred.
      • getDocumentCount

        public int getDocumentCount()

        Returns the number of documents inside the XPS package.

        Returns:
        The number of documents inside the XPS package.
      • getTotalPageCount

        public int getTotalPageCount()

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

        Returns:
        The total number of pages in all documents inside XPS document.
      • getPageCount

        public int getPageCount()

        Returns the number of pages in the active document.

        Returns:
        The number of pages in the active document.
      • getJobPrintTicket

        public JobPrintTicket getJobPrintTicket()

        Returns the document's job print ticket.

        Returns:
        The document's job print ticket.
      • setJobPrintTicket

        public void setJobPrintTicket(JobPrintTicket value)

        Sets the document's job print ticket.

        Parameters:
        value - The document's job print ticket.
      • getDocumentPrintTicket

        public DocumentPrintTicket getDocumentPrintTicket(int documentIndex)

        Gets the print ticket of the document indexed by documentIndex.

        Parameters:
        documentIndex - Index of the document whose print ticket to return.
        Returns:
        Document's print ticket.
      • setDocumentPrintTicket

        public void setDocumentPrintTicket(int documentIndex,
                                           DocumentPrintTicket printTicket)

        Links the printTicket to the document indexed by documentIndex.

        Parameters:
        documentIndex - Index of the document to link the print ticket to.
        printTicket - The print ticket to link.
      • getPagePrintTicket

        public PagePrintTicket getPagePrintTicket(int documentIndex,
                                                  int pageIndex)

        Gets the print ticket of the page indexed by pageIndex in the document indexed by documentIndex.

        Parameters:
        documentIndex - Index of the document.
        pageIndex - Index of the page whose print ticket to return.
        Returns:
        Page's print ticket.
      • setPagePrintTicket

        public void setPagePrintTicket(int documentIndex,
                                       int pageIndex,
                                       PagePrintTicket printTicket)

        Links the printTicket to the page indexed by pageIndex in the document indexed by documentIndex.

        Parameters:
        documentIndex - Index of the document.
        pageIndex - Index of the page to link the print ticket to.
        printTicket - The print ticket to link.
      • add

        public <T extends XpsContentElement> T add(T element)

        Adds a content element (Canvas, Path or Glyphs)

        Type Parameters:
        T - The type of the element to add.
        Parameters:
        element - The element to add.
        Returns:
        Added element.
      • insert

        public <T extends XpsContentElement> T insert(int index,
                                                      T element)

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

        Type Parameters:
        T - The type of the element to insert.
        Parameters:
        index - Position at which an element should be inserted.
        element - The element to insert.
        Returns:
        Inserted element.
      • remove

        public <T extends XpsContentElement> T remove(T element)

        Removes an element from the active page.

        Type Parameters:
        T - The type of the element to remove.
        Parameters:
        element - The element to remove.
        Returns:
        Removed element.
      • removeAt

        public XpsContentElement removeAt(int index)

        Removes an element at index position from the active page.

        Parameters:
        index - Position at which element should be removed.
        Returns:
        Removed element.
      • addDocument

        public void addDocument()

        Adds an empty document with default page size and selects added document as active.

      • addDocument

        public void addDocument(boolean activate)

        Adds an empty document with default page size.

        Parameters:
        activate - Flag indicating whether to select added document as active.
      • addDocument

        public void addDocument(float width,
                                float height)

        Adds an empty document with the first page dimensions width and height and selects added document as active.

        Parameters:
        width - Width of the first page.
        height - Height of the first page.
      • addDocument

        public void addDocument(float width,
                                float height,
                                boolean activate)

        Adds an empty document with the first page dimensions width and height.

        Parameters:
        width - Width of the first page.
        height - Height of the first page.
        activate - Flag indicating whether to select added document as active.
      • insertDocument

        public void insertDocument(int index)

        Inserts an empty document with default page size at index position and selects inserted document as active.

        Parameters:
        index - Position at which a document should be inserted.
      • insertDocument

        public void insertDocument(int index,
                                   boolean activate)

        Inserts an empty document with default page size at index position.

        Parameters:
        index - Position at which a document should be inserted.
        activate - Flag indicating whether to select inserted document as active.
      • insertDocument

        public void insertDocument(int index,
                                   float width,
                                   float height)

        Inserts an empty document with the first page dimensions width and height at index position and selects inserted document as active.

        Parameters:
        index - Position at which a document should be inserted.
        width - Width of the first page.
        height - Height of the first page.
      • insertDocument

        public void insertDocument(int index,
                                   float width,
                                   float height,
                                   boolean activate)

        Inserts an empty document with the first page dimensions width and height at index position.

        Parameters:
        index - Position at which a document should be inserted.
        width - Width of the first page.
        height - Height of the first page.
        activate - Flag indicating whether to select inserted document as active.
      • removeDocumentAt

        public void removeDocumentAt(int index)

        Removes a document at index position.

        Parameters:
        index - Position at which a document should be removed.
      • addPage

        public XpsPage addPage()

        Adds an empty page to the document with default page size.

        Returns:
        Added page.
      • addPage

        public XpsPage addPage(boolean activate)

        Adds an empty page to the document with default page size.

        Parameters:
        activate - Flag indicating whether to select added page as active.
        Returns:
        Added page.
      • addPage

        public XpsPage addPage(float width,
                               float height)

        Adds an empty page to the document with specified width and height.

        Parameters:
        width - Width of a new page.
        height - Height of a new page.
        Returns:
        Added page.
      • addPage

        public XpsPage addPage(float width,
                               float height,
                               boolean activate)

        Adds an empty page to the document with specified width and height.

        Parameters:
        width - Width of a new page.
        height - Height of a new page.
        activate - Flag indicating whether to select added page as active.
        Returns:
        Added page.
      • addPage

        public XpsPage addPage(XpsPage page)

        Adds a page to the document and selects added page as active.

        Parameters:
        page - Page to be added.
        Returns:
        Added page.
      • addPage

        public XpsPage addPage(XpsPage page,
                               boolean activate)

        Adds a page to the document.

        Parameters:
        page - Page to be added.
        activate - Flag indicating whether to select added page as active.
        Returns:
        Added page.
      • removePage

        public XpsPage removePage(XpsPage page)

        Removes a page from the document.

        Parameters:
        page - Page to be removed.
        Returns:
        Removed page.
      • insertPage

        public XpsPage insertPage(int index)

        Inserts an empty page to the document with default page size at index position and select inserted page as active.

        Parameters:
        index - Position at which a page should be inserted.
        Returns:
        Inserted page.
      • insertPage

        public XpsPage insertPage(int index,
                                  boolean activate)

        Inserts an empty page to the document with default page size at index position.

        Parameters:
        index - Position at which a page should be inserted.
        activate - Flag indicating whether to select inserted page as active.
        Returns:
        Inserted page.
      • insertPage

        public XpsPage insertPage(int index,
                                  float width,
                                  float height)

        Inserts an empty page to the document with specified width and height at index position and selects inserted page as active.

        Parameters:
        index - Position at which a page should be inserted.
        width - Width of a new page.
        height - Height of a new page.
        Returns:
        Inserted page.
      • insertPage

        public XpsPage insertPage(int index,
                                  float width,
                                  float height,
                                  boolean activate)

        Inserts an empty page to the document with specified width and height at index position.

        Parameters:
        index - Position at which a page should be inserted.
        width - Width of a new page.
        height - Height of a new page.
        activate - Flag indicating whether to select inserted page as active.
        Returns:
        Inserted page.
      • insertPage

        public XpsPage insertPage(int index,
                                  XpsPage page)

        Inserts a page to the document at index position and selects inserted page as active.

        Parameters:
        index - Position at which a page should be added.
        page - Page to be inserted.
        Returns:
        Inserted page.
      • insertPage

        public XpsPage insertPage(int index,
                                  XpsPage page,
                                  boolean activate)

        Inserts a page to the document at index position.

        Parameters:
        index - Position at which a page should be added.
        page - Page to be inserted.
        activate - Flag indicating whether to select inserted page as active.
        Returns:
        Inserted page.
      • removePageAt

        public XpsPage removePageAt(int index)

        Removes a page from the document at index position.

        Parameters:
        index - Position at which a page should be removed.
        Returns:
        Removed page.
      • createCanvas

        public XpsCanvas createCanvas()

        Creates a new canvas.

        Returns:
        New canvas.
      • addCanvas

        public XpsCanvas addCanvas()

        Adds a new canvas to the active page.

        Returns:
        Added canvas.
      • insertCanvas

        public XpsCanvas insertCanvas(int index)

        Inserts a new canvas to the active page at index position.

        Parameters:
        index - Position at which a new canvas should be inserted.
        Returns:
        Inserted canvas.
      • createPath

        public XpsPath createPath(XpsPathGeometry data)

        Creates a new path.

        Parameters:
        data - The geometry of the path.
        Returns:
        New path.
      • addPath

        public XpsPath addPath(XpsPathGeometry data)

        Adds a new path to the active page.

        Parameters:
        data - The geometry of the path.
        Returns:
        Added path.
      • insertPath

        public XpsPath insertPath(int index,
                                  XpsPathGeometry data)

        Inserts a new path to the active page at index position.

        Parameters:
        index - Position at which a new path should be inserted.
        data - The geometry of the path.
        Returns:
        Inserted path.
      • createGlyphs

        public XpsGlyphs createGlyphs(String fontFamily,
                                      float fontRenderingEmSize,
                                      XpsFontStyle fontStyle,
                                      float originX,
                                      float originY,
                                      String unicodeString)

        Creates new glyphs.

        Parameters:
        fontFamily - Font family.
        fontRenderingEmSize - Font size.
        fontStyle - Font style.
        originX - Glyphs origin X coordinate.
        originY - Glyphs origin Y coordinate.
        unicodeString - String to be printed.
        Returns:
        New glyphs.
      • createGlyphs

        public XpsGlyphs createGlyphs(XpsFont font,
                                      float fontRenderingEmSize,
                                      float originX,
                                      float originY,
                                      String unicodeString)

        Creates new glyphs.

        Parameters:
        font - Font resource.
        fontRenderingEmSize - Font size.
        originX - Glyphs origin X coordinate.
        originY - Glyphs origin Y coordinate.
        unicodeString - String to be printed.
        Returns:
        New glyphs.
      • addGlyphs

        public XpsGlyphs addGlyphs(String fontFamily,
                                   float fontRenderingEmSize,
                                   XpsFontStyle fontStyle,
                                   float originX,
                                   float originY,
                                   String unicodeString)

        Adds new glyphs to the active page.

        Parameters:
        fontFamily - Font family.
        fontRenderingEmSize - Font size.
        fontStyle - Font style.
        originX - Glyphs origin X coordinate.
        originY - Glyphs origin Y coordinate.
        unicodeString - String to be printed.
        Returns:
        Added glyphs.
      • insertGlyphs

        public XpsGlyphs insertGlyphs(int index,
                                      String fontFamily,
                                      float fontSize,
                                      XpsFontStyle fontStyle,
                                      float originX,
                                      float originY,
                                      String unicodeString)

        Inserts new glyphs to the active page at index position.

        Parameters:
        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.
        Returns:
        Inserted glyphs.
      • addGlyphs

        public XpsGlyphs addGlyphs(XpsFont font,
                                   float fontRenderingEmSize,
                                   float originX,
                                   float originY,
                                   String unicodeString)

        Adds new glyphs to the active page.

        Parameters:
        font - Font resource.
        fontRenderingEmSize - Font size.
        originX - Glyphs origin X coordinate.
        originY - Glyphs origin Y coordinate.
        unicodeString - String to be printed.
        Returns:
        Added glyphs.
      • insertGlyphs

        public XpsGlyphs insertGlyphs(int index,
                                      XpsFont font,
                                      float fontSize,
                                      float originX,
                                      float originY,
                                      String unicodeString)

        Inserts new glyphs to the active page at index position.

        Parameters:
        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.
        Returns:
        Inserted glyphs.
      • createMatrix

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

        Creates a new affine transformation matrix.

        Parameters:
        m11 - Element 11.
        m12 - Element 12.
        m21 - Element 21.
        m22 - Element 22.
        m31 - Element 31.
        m32 - Element 32.
        Returns:
        New affine transformation matrix.
      • createPathGeometry

        public XpsPathGeometry createPathGeometry()

        Creates a new path geometry.

        Returns:
        New path geometry.
      • createPathGeometry

        public XpsPathGeometry createPathGeometry(List<XpsPathFigure> pathFigures)

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

        Parameters:
        pathFigures - List of path figures.
        Returns:
        New path geometry.
      • createPathGeometry

        public XpsPathGeometry createPathGeometry(String abbreviatedGeometry)

        Creates a new path geometry specified with abbreviated form.

        Parameters:
        abbreviatedGeometry - Abbreviated form of path geometry.
        Returns:
        New path geometry.
      • createPathFigure

        public XpsPathFigure createPathFigure(Point2D startPoint)

        Creates a new open path figure.

        Parameters:
        startPoint - The starting point for the first segment of the path figure.
        Returns:
        New path figure.
      • createPathFigure

        public XpsPathFigure createPathFigure(Point2D startPoint,
                                              boolean isClosed)

        Creates a new path figure.

        Parameters:
        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.
        Returns:
        New path figure.
      • createPathFigure

        public XpsPathFigure createPathFigure(Point2D startPoint,
                                              List<XpsPathSegment> segments)

        Creates a new open path figure.

        Parameters:
        startPoint - The starting point for the first segment of the path figure.
        segments - List of path segments.
        Returns:
        New path figure.
      • createPathFigure

        public XpsPathFigure createPathFigure(Point2D startPoint,
                                              List<XpsPathSegment> segments,
                                              boolean isClosed)

        Creates a new path figure.

        Parameters:
        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.
        Returns:
        New path figure.
      • createArcSegment

        public XpsArcSegment createArcSegment(Point2D point,
                                              Dimension2D size,
                                              float rotationAngle,
                                              boolean isLargeArc,
                                              XpsSweepDirection sweepDirection)

        Creates a new stroked elliptical arc segment.

        Parameters:
        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.
        Returns:
        New elliptical arc segment.
      • createArcSegment

        public XpsArcSegment createArcSegment(Point2D point,
                                              Dimension2D size,
                                              float rotationAngle,
                                              boolean isLargeArc,
                                              XpsSweepDirection sweepDirection,
                                              boolean isStroked)

        Creates a new elliptical arc segment.

        Parameters:
        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.
        Returns:
        New elliptical arc segment.
      • createPolyLineSegment

        public XpsPolyLineSegment createPolyLineSegment(Point2D[] points)

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

        Parameters:
        points - A set of coordinates for the multiple segments that define the poly line segment.
        Returns:
        New polygonal drawing segment.
      • createPolyLineSegment

        public XpsPolyLineSegment createPolyLineSegment(Point2D[] points,
                                                        boolean isStroked)

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

        Parameters:
        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.
        Returns:
        New polygonal drawing segment.
      • createPolyBezierSegment

        public XpsPolyBezierSegment createPolyBezierSegment(Point2D[] points)

        Creates a new set of stroked cubic Bézier curves.

        Parameters:
        points - Control points for multiple Bézier segments.
        Returns:
        New cubic Bézier curves segment.
      • createPolyBezierSegment

        public XpsPolyBezierSegment createPolyBezierSegment(Point2D[] points,
                                                            boolean isStroked)

        Creates a new set of cubic Bézier curves.

        Parameters:
        points - Control points for multiple Bézier segments.
        isStroked - Specifies whether the stroke for this segment of the path is drawn.
        Returns:
        New cubic Bézier curves segment.
      • createPolyQuadraticBezierSegment

        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.

        Parameters:
        points - Control points for multiple quadratic Bézier segments.
        Returns:
        New quadratic Bézier curves segment.
      • createPolyQuadraticBezierSegment

        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.

        Parameters:
        points - Control points for multiple quadratic Bézier segments.
        isStroked - Specifies whether the stroke for this segment of the path is drawn.
        Returns:
        New quadratic Bézier curves segment.
      • createSolidColorBrush

        public XpsSolidColorBrush createSolidColorBrush(XpsColor color)

        Creates a new solid color brush.

        Parameters:
        color - The color for filled elements.
        Returns:
        New solid color brush.
      • createSolidColorBrush

        public XpsSolidColorBrush createSolidColorBrush(Color color)

        Creates a new solid color brush.

        Parameters:
        color - The color for filled elements.
        Returns:
        New solid color brush.
      • createGradientStop

        public XpsGradientStop createGradientStop(XpsColor color,
                                                  float offset)

        Creates a new gradient stop.

        Parameters:
        color - The gradient stop color.
        offset - The gradient offset.
        Returns:
        New gradient stop.
      • createGradientStop

        public XpsGradientStop createGradientStop(Color color,
                                                  float offset)

        Creates a new gradient stop.

        Parameters:
        color - The gradient stop color.
        offset - The gradient offset.
        Returns:
        New gradient stop.
      • createLinearGradientBrush

        public XpsLinearGradientBrush createLinearGradientBrush(List<XpsGradientStop> gradientStops,
                                                                Point2D startPoint,
                                                                Point2D endPoint)

        Creates a new linear gradient brush.

        Parameters:
        gradientStops - The list of gradient stops.
        startPoint - The starting point of the linear gradient.
        endPoint - The end point of the linear gradient.
        Returns:
        New linear gradient brush.
      • createLinearGradientBrush

        public XpsLinearGradientBrush createLinearGradientBrush(Point2D startPoint,
                                                                Point2D endPoint)

        Creates a new linear gradient brush.

        Parameters:
        startPoint - The starting point of the linear gradient.
        endPoint - The end point of the linear gradient.
        Returns:
        New linear gradient brush.
      • createRadialGradientBrush

        public XpsRadialGradientBrush createRadialGradientBrush(List<XpsGradientStop> gradientStops,
                                                                Point2D center,
                                                                Point2D gradientOrigin,
                                                                float radiusX,
                                                                float radiusY)

        Creates a new radial gradient brush.

        Parameters:
        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.
        Returns:
        New radial gradient brush.
      • createRadialGradientBrush

        public XpsRadialGradientBrush createRadialGradientBrush(Point2D center,
                                                                Point2D gradientOrigin,
                                                                float radiusX,
                                                                float radiusY)

        Creates a new radial gradient brush.

        Parameters:
        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.
        Returns:
        New radial gradient brush.
      • createVisualBrush

        public XpsVisualBrush createVisualBrush(XpsContentElement element,
                                                Rectangle2D viewbox,
                                                Rectangle2D viewport)

        Creates a new visual brush.

        Parameters:
        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 applied
        Returns:
        New visual brush.
      • createImageBrush

        public XpsImageBrush createImageBrush(XpsImage image,
                                              Rectangle2D viewbox,
                                              Rectangle2D viewport)

        Creates a new image brush.

        Parameters:
        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 applied
        Returns:
        New image brush.
      • createImageBrush

        public XpsImageBrush createImageBrush(String imagePath,
                                              Rectangle2D viewbox,
                                              Rectangle2D viewport)

        Creates a new image brush.

        Parameters:
        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 applied
        Returns:
        New image brush.
      • createColor

        public XpsColor createColor(Color color)

        Creates a new color.

        Parameters:
        color - A native color instance for RGB color.
        Returns:
        New color.
      • createColor

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

        Creates a new color in sRGB color space.

        Parameters:
        a - The alpha color component.
        r - The red color component.
        g - The green color component.
        b - The blue color component.
        Returns:
        New color.
      • createColor

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

        Creates a new color in sRGB color space.

        Parameters:
        r - The red color component.
        g - The green color component.
        b - The blue color component.
        Returns:
        New color.
      • createColor

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

        Creates a new color in scRGB color space.

        Parameters:
        a - The alpha color component.
        r - The red color component.
        g - The green color component.
        b - The blue color component.
        Returns:
        New color.
      • createColor

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

        Creates a new color in scRGB color space.

        Parameters:
        r - The red color component.
        g - The green color component.
        b - The blue color component.
        Returns:
        New color.
      • createColor

        public XpsColor createColor(String path,
                                    float... components)

        Creates a new color in ICC based color space.

        Parameters:
        path - The path to the ICC profile.
        components - Color components.
        Returns:
        New color.
      • createColor

        public XpsColor createColor(XpsIccProfile iccProfile,
                                    float... components)

        Creates a new color in ICC based color space.

        Parameters:
        iccProfile - The ICC profile resource.
        components - Color components.
        Returns:
        New color.
      • createImage

        public XpsImage createImage(String imagePath)

        Creates a new image resource out of image file located at the imagePath.

        Parameters:
        imagePath - The path to the image to take as a resource.
        Returns:
        New image resource.
      • createImage

        public XpsImage createImage(InputStream stream)

        Creates a new image resource out of stream.

        Parameters:
        stream - The stream containing the image to take as a resource.
        Returns:
        New image resource.
      • createIccProfile

        public XpsIccProfile createIccProfile(String iccProfilePath)

        Creates a new ICC profile resource out of ICC profile file located at the iccProfilePath.

        Parameters:
        iccProfilePath - The path to the ICC profile to take as a resource.
        Returns:
        New ICC profile resource.
      • createIccProfile

        public XpsIccProfile createIccProfile(InputStream stream)

        Creates a new ICC profile resource out of stream.

        Parameters:
        stream - The stream containing the ICC profile to take as a resource.
        Returns:
        New ICC profile resource.
      • createFont

        public XpsFont createFont(String fontFamily,
                                  XpsFontStyle fontStyle)

        Creates a new TrueType font resource.

        Parameters:
        fontFamily - The font family.
        fontStyle - The font style. See XpsFont class constants (which are bit flags) for values available to combine.
        Returns:
        New TrueType font resource.
      • createFont

        public XpsFont createFont(InputStream stream)

        Creates a new TrueType font resource out of stream.

        Parameters:
        stream - The stream containing the ICC profile to take as a resource.
        Returns:
        New TrueType font resource.
      • addOutlineEntry

        public void addOutlineEntry(String description,
                                    int outlineLevel,
                                    XpsHyperlinkTarget target)

        Adds an outline entry to the document.

        Parameters:
        description - The entry description.
        outlineLevel - The outline level.
        target - The entry target.