com.aspose.xps.rendering

Class PdfDevice

    • Constructor Detail

      • PdfDevice

        public PdfDevice(OutputStream stream)

        Creates the new instance.

        Parameters:
        stream - The output stream containing PDF.
      • PdfDevice

        public PdfDevice(OutputStream stream,
                         Dimension pageSize)

        Creates the new instance with specified media size.

        Parameters:
        stream - The output stream containing PDF.
        pageSize - The size of the device output media.
    • Method Detail

      • renew

        public void renew()

        Sets the devices to the initial state.

        Overrides:
        renew in class Device
      • setSaveOptions

        public void setSaveOptions(SaveOptions value)

        Initializes save options.

        Overrides:
        setSaveOptions in class Device
        Parameters:
        value - Save options.
      • getSize

        public Dimension getSize()

        Gets the device media size.

        Overrides:
        getSize in class Device
        Returns:
        The device media size.
      • setSize

        public void setSize(Dimension value)

        Sets the device media size.

        Overrides:
        setSize in class Device
        Parameters:
        value - The device media size.
      • getBackground

        public Color getBackground()

        Gets the background color.

        Overrides:
        getBackground in class Device
        Returns:
        The background color.
      • setBackground

        public void setBackground(Color value)

        Sets the background color.

        Overrides:
        setBackground in class Device
        Parameters:
        value - The background color.
      • getOpacity

        public float getOpacity()

        Gets the opacity.

        Overrides:
        getOpacity in class Device
        Returns:
        The opacity.
      • setOpacity

        public void setOpacity(float value)

        Sets the opacity.

        Overrides:
        setOpacity in class Device
        Parameters:
        value - The opacity.
      • getStroke

        public Stroke getStroke()

        Gets the stroke for drawing paths.

        Overrides:
        getStroke in class Device
        Returns:
        The stroke for drawing paths.
      • setStroke

        public void setStroke(Stroke value)

        Sets the stroke for drawing paths.

        Overrides:
        setStroke in class Device
        Parameters:
        value - The stroke for drawing paths.
      • getPaint

        public Paint getPaint()

        Gets the brush for filling paths.

        Overrides:
        getPaint in class Device
        Returns:
        The brush for filling paths.
      • setPaint

        public void setPaint(Paint value)

        Sets the brush for filling paths.

        Overrides:
        setPaint in class Device
        Parameters:
        value - The brush for filling paths.
      • getOpacityMask

        public Paint getOpacityMask()

        Gets the brush for opacity mask. The mask applies over Paint or Strike.

        Overrides:
        getOpacityMask in class Device
        Returns:
        The brush for opacity mask.
      • setOpacityMask

        public void setOpacityMask(Paint value)

        Gets the brush for opacity mask. The mask applies over Paint or Strike.

        Overrides:
        setOpacityMask in class Device
        Parameters:
        value - The brush for opacity mask.
      • getFont

        public ITrFont getFont()

        Gets the current font.

        Overrides:
        getFont in class Device
        Returns:
        The current font.
      • setFont

        public void setFont(ITrFont value)

        Sets the current font.

        Overrides:
        setFont in class Device
        Parameters:
        value - The current font.
      • startDocument

        public void startDocument()

        Starts the document.

        Overrides:
        startDocument in class Device
      • endDocument

        public void endDocument()

        Accomplishes the document.

        Overrides:
        endDocument in class Device
      • reset

        public void reset()
        Resets the device.
        Overrides:
        reset in class Device
      • openPage

        public boolean openPage(String title)

        Starts a new page with the specifies title.

        Specified by:
        openPage in interface IMultiPageDevice
        Parameters:
        title - The title.
        Returns:
        True if started page is to be output (it's number is contained in PageNumbers save options). False , otherwise.
      • openPage

        public boolean openPage(float width,
                                float height)

        Starts a new page with the specified width and height.

        Specified by:
        openPage in interface IMultiPageDevice
        Parameters:
        width - The width of the page.
        height - The height of the page.
        Returns:
        True if started page is to be output (it's number is contained in PageNumbers save options). False , otherwise.
      • getCurrentPageNumber

        public int getCurrentPageNumber()

        Returns the absolute number of the current page within the document.

        Specified by:
        getCurrentPageNumber in interface IMultiPageDevice
        Returns:
        The absolute number of the current page.
      • getCurrentRelativePageNumber

        public int getCurrentRelativePageNumber()

        Returns the relative number of the current page within the current partition.

        Specified by:
        getCurrentRelativePageNumber in interface IMultiPartitionDevice
        Returns:
        The relative number of the current page.
      • setHyperlinkTarget

        public void setHyperlinkTarget(String targetUri)

        Sets the hyperlink with an external URI as its target.

        Specified by:
        setHyperlinkTarget in interface IInteractiveDevice
        Parameters:
        targetUri - The target external URI.
      • setHyperlinkTarget

        public void setHyperlinkTarget(int targetPageNumber)

        Sets the hyperlink with a page number as its target.

        Specified by:
        setHyperlinkTarget in interface IInteractiveDevice
        Parameters:
        targetPageNumber - The target page number.
      • addOutline

        public void addOutline(int outlineLevel,
                               String description)

        Adds an outline item with the last object as its target.

        Specified by:
        addOutline in interface IInteractiveDevice
        Parameters:
        outlineLevel - The outline level.
        description - The item description.
      • addOutline

        public void addOutline(Point2D origin,
                               int outlineLevel,
                               String description)

        Adds an outline item with the origin point as its target.

        Specified by:
        addOutline in interface IInteractiveDevice
        Parameters:
        origin - The target origin.
        outlineLevel - The outline level.
        description - The item description.
      • create

        public Device create()

        Creates a new instance of the device based on this device instance. Writes this device graphics state, i.e. creates ApsCanvas instance(s) with corresponding RenderTransform and Clip properties.

        Overrides:
        create in class Device
        Returns:
        The new device instance.
      • dispose

        public void dispose()

        Disposes this device instance. Finalizes this device instance graphics state, i.e. switches APS composing context to the ApsCanvas of the level higher then this device's graphics state ApsCanvas.

        Overrides:
        dispose in class Device
      • getTransform

        public AffineTransform getTransform()

        Returns the current transformation matrix.

        Overrides:
        getTransform in class Device
        Returns:
        The current transformation matrix.
      • setTransform

        public void setTransform(AffineTransform transform)

        Sets the current transformation matrix.

        Overrides:
        setTransform in class Device
        Parameters:
        transform - The new transformation matrix.
      • transform

        public void transform(AffineTransform transform)

        Multiplies the current transformation matrix by the specified Matrix.

        Overrides:
        transform in class Device
        Parameters:
        transform - The matrix by which the current transformation matrix is to be multiplied.
      • translate

        public void translate(double x,
                              double y)

        Applies the specified translation vector to the current transformation matrix.

        Overrides:
        translate in class Device
        Parameters:
        x - The x offset.
        y - The y offset.
      • rotate

        public void rotate(double theta)

        Applies a clockwise rotation about the origin to the current transformation matrix.

        Overrides:
        rotate in class Device
        Parameters:
        theta - The angle of the rotation, in radians.
      • scale

        public void scale(double x,
                          double y)

        Applies the specified scale vector to the current transformation matrix.

        Overrides:
        scale in class Device
        Parameters:
        x - The x scale factor.
        y - The y scale factor.
      • shear

        public void shear(double shx,
                          double shy)

        Applies the specified shear vector to the current transformation matrix.

        Overrides:
        shear in class Device
        Parameters:
        shx - The x shear factor.
        shy - The y shear factor.
      • setClip

        public void setClip(Shape clipPath)

        Adds the specified path to the current clip path.

        Overrides:
        setClip in class Device
        Parameters:
        clipPath - The clip path to be added.
      • draw

        public void draw(Shape path)

        Draws the specified path.

        Overrides:
        draw in class Device
        Parameters:
        path - The path to draw.
      • fill

        public void fill(Shape path)

        Fills the specified path.

        Overrides:
        fill in class Device
        Parameters:
        path - The path to fill.
      • drawString

        public void drawString(String str,
                               float x,
                               float y)
        Draws a string at the specified position.
        Overrides:
        drawString in class Device
        Parameters:
        str - The text.
        x - The x-coordinate of the string position.
        y - The y-coordinate of the string position.