SvgDevice

Inheritance: java.lang.Object, com.aspose.tex.rendering.Device

All Implemented Interfaces: com.aspose.tex.rendering.IInteractiveDevice, com.aspose.tex.rendering.IFragmentRasterizer, com.aspose.tex.rendering.IPageCropper

public class SvgDevice extends Device implements IInteractiveDevice, IFragmentRasterizer, IPageCropper

Implements the interface for outputting text and graphic content to image(s).

Constructors

ConstructorDescription
SvgDevice()Creates a new instance.

Methods

MethodDescription
initialize()Initializes device.
getPageCount()Gets the number of pages.
isReady()Shows if device is ready for output.
getDestinationName()Gets destination name: output file name or device description.
create()Creates a copy of this device.
dispose()Disposes this device instance.
startDocument()Starts the whole document.
endDocument()Finalizes the whole document.
startPage(float width, float height)Starts a new page.
endPage()Finalizes a page.
addHyperlink(Rectangle2D activeRect, ColoredStroke border, String targetUri)Sets the hyperlink with a URI as its target.
addBookmark(String name, Point2D position)Adds the bookmark identified by the name.
setTransform(AffineTransform matrix)Sets the current coordinate space transformation.
setClip(Shape path)Sets the current clip path.
getStroke()Gets the current stroke.
setStroke(ColoredStroke value)Sets the current stroke.
getFill()Gets the current fill color.
setFill(Color value)Sets the current fill color.
getStrokeOpacity()Gets the current stroke opacity.
setStrokeOpacity(float value)Sets the current stroke opacity.
getFillOpacity()Gets the current fill opacity.
setFillOpacity(float value)Sets the current fill opacity.
drawString(String str, float originX, float originY, List charInfos)Draws a text string.
drawPath(Shape path)Draws a path.
fillPath(Shape path)Fills a path.
showImage(Point2D origin, Dimension2D size, byte[] imageData)Shows a raster image.
startFragment()Starts a fragment to rasterize.
endFragment()Ends a fragment to rasterize.
cropPage(int scale, Color bgColor, float margin)

SvgDevice()

public SvgDevice()

Creates a new instance. The output file will be written to the output working directory taking the job name as a file name.

initialize()

public void initialize()

Initializes device.

getPageCount()

public int getPageCount()

Gets the number of pages.

Returns: int

isReady()

public boolean isReady()

Shows if device is ready for output.

Returns: boolean

getDestinationName()

public String getDestinationName()

Gets destination name: output file name or device description.

Returns: java.lang.String

create()

public Device create()

Creates a copy of this device.

Returns: Device - Copy of this device.

dispose()

public void dispose()

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

startDocument()

public void startDocument()

Starts the whole document.

endDocument()

public void endDocument()

Finalizes the whole document.

startPage(float width, float height)

public void startPage(float width, float height)

Starts a new page.

Parameters:

ParameterTypeDescription
widthfloatThe page width.
heightfloatThe page height.

endPage()

public void endPage()

Finalizes a page.

public void addHyperlink(Rectangle2D activeRect, ColoredStroke border, String targetUri)

Sets the hyperlink with a URI as its target.

Parameters:

ParameterTypeDescription
activeRectjava.awt.geom.Rectangle2DThe active rectangle of the link.
borderColoredStrokeThe link border.
targetUrijava.lang.StringThe target URI.

addBookmark(String name, Point2D position)

public void addBookmark(String name, Point2D position)

Adds the bookmark identified by the name.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe bookmark name.
positionjava.awt.geom.Point2DThe bookmark position.

setTransform(AffineTransform matrix)

public void setTransform(AffineTransform matrix)

Sets the current coordinate space transformation.

Parameters:

ParameterTypeDescription
matrixjava.awt.geom.AffineTransformThe transformation matrix.

setClip(Shape path)

public void setClip(Shape path)

Sets the current clip path.

Parameters:

ParameterTypeDescription
pathjava.awt.ShapeThe clip path.

getStroke()

public ColoredStroke getStroke()

Gets the current stroke.

Returns: ColoredStroke - The current stroke.

setStroke(ColoredStroke value)

public void setStroke(ColoredStroke value)

Sets the current stroke.

Parameters:

ParameterTypeDescription
valueColoredStrokeThe new current stroke.

getFill()

public Color getFill()

Gets the current fill color.

Returns: java.awt.Color - The current fill color.

setFill(Color value)

public void setFill(Color value)

Sets the current fill color.

Parameters:

ParameterTypeDescription
valuejava.awt.ColorThe new current fill color.

getStrokeOpacity()

public float getStrokeOpacity()

Gets the current stroke opacity.

Returns: float - The current stroke opacity.

setStrokeOpacity(float value)

public void setStrokeOpacity(float value)

Sets the current stroke opacity.

Parameters:

ParameterTypeDescription
valuefloatThe current stroke opacity.

getFillOpacity()

public float getFillOpacity()

Gets the current fill opacity.

Returns: float - The current fill opacity.

setFillOpacity(float value)

public void setFillOpacity(float value)

Sets the current fill opacity.

Parameters:

ParameterTypeDescription
valuefloatThe current fill opacity.

drawString(String str, float originX, float originY, List charInfos)

public void drawString(String str, float originX, float originY, List<GlyphData> charInfos)

Draws a text string.

Parameters:

ParameterTypeDescription
strjava.lang.StringThe string.
originXfloatThe x coordinate of the origin.
originYfloatThe x coordinate of the origin.
charInfosjava.util.List<com.aspose.tex.rendering.GlyphData>Glyph data required for precise typesetting of a text string.

drawPath(Shape path)

public void drawPath(Shape path)

Draws a path.

Parameters:

ParameterTypeDescription
pathjava.awt.ShapeA path to draw.

fillPath(Shape path)

public void fillPath(Shape path)

Fills a path.

Parameters:

ParameterTypeDescription
pathjava.awt.ShapeA path to fill.

showImage(Point2D origin, Dimension2D size, byte[] imageData)

public void showImage(Point2D origin, Dimension2D size, byte[] imageData)

Shows a raster image.

Parameters:

ParameterTypeDescription
originjava.awt.geom.Point2DThe bottom-left corner of the shown image.
sizejava.awt.geom.Dimension2DThe size of the shown image.
imageDatabyte[]The image data.

startFragment()

public void startFragment()

Starts a fragment to rasterize.

endFragment()

public void endFragment()

Ends a fragment to rasterize.

cropPage(int scale, Color bgColor, float margin)

public void cropPage(int scale, Color bgColor, float margin)

Parameters:

ParameterTypeDescription
scaleint
bgColorjava.awt.Color
marginfloat