PdfDevice
Inheritance: java.lang.Object, com.aspose.page.Device, com.aspose.xps.rendering.DeviceXps
All Implemented Interfaces: com.aspose.page.IMultiPartitionDevice, com.aspose.page.IInteractiveDevice
public class PdfDevice extends DeviceXps implements IMultiPartitionDevice, IInteractiveDevice
Class incapsulating image composing device.
Constructors
Constructor | Description |
---|---|
PdfDevice(OutputStream stream) | Creates the new instance. |
PdfDevice(OutputStream stream, Dimension pageSize) | Creates the new instance with specified media size. |
Methods
Method | Description |
---|---|
renew() | Sets the devices to the initial state. |
setSaveOptions(SaveOptions value) | Initializes save options. |
getSize() | Gets the device media size. |
setSize(Dimension value) | Sets the device media size. |
getBackground() | Gets the background color. |
setBackground(Color value) | Sets the background color. |
getOpacity() | Gets the opacity. |
setOpacity(float value) | Sets the opacity. |
getStroke() | Gets the stroke for drawing paths. |
setStroke(Stroke value) | Sets the stroke for drawing paths. |
getPaint() | Gets the brush for filling paths. |
setPaint(Paint value) | Sets the brush for filling paths. |
getOpacityMask() | Gets the brush for opacity mask. |
setOpacityMask(Paint value) | Gets the brush for opacity mask. |
getFont() | Gets the current font. |
setFont(ITrFont value) | Sets the current font. |
startDocument() | Starts the document. |
endDocument() | Accomplishes the document. |
reset() | Resets the device. |
initPageNumbers() | Initializes numbers of pages to output. |
openPage(String title) | Starts a new page with the specifies title. |
openPage(float width, float height) | Starts a new page with the specified width and height. |
closePage() | Accomplishes the page. |
updatePageParameters(IMultiPageDevice device) | Updates the current page parameters. |
getCurrentPageNumber() | Returns the absolute number of the current page within the document. |
getCurrentRelativePageNumber() | Returns the relative number of the current page within the current partition. |
openPartition() | Starts a new document partition. |
closePartition() | Accomplished the document partition. |
setHyperlinkTarget(String targetUri) | Sets the hyperlink with an external URI as its target. |
setHyperlinkTarget(int targetPageNumber) | Sets the hyperlink with a page number as its target. |
addOutline(int outlineLevel, String description) | Adds an outline item with the last object as its target. |
addOutline(Point2D origin, int outlineLevel, String description) | Adds an outline item with the origin point as its target. |
create() | Creates a new instance of the device based on this device instance. |
dispose() | Disposes this device instance. |
getTransform() | Returns the current transformation matrix. |
setTransform(AffineTransform transform) | Sets the current transformation matrix. |
transform(AffineTransform transform) | Multiplies the current transformation matrix by the specified Matrix . |
translate(double x, double y) | Applies the specified translation vector to the current transformation matrix. |
rotate(double theta) | Applies a clockwise rotation about the origin to the current transformation matrix. |
scale(double x, double y) | Applies the specified scale vector to the current transformation matrix. |
shear(double shx, double shy) | Applies the specified shear vector to the current transformation matrix. |
setClip(Shape clipPath) | Adds the specified path to the current clip path. |
draw(Shape path) | Draws the specified path. |
fill(Shape path) | Fills the specified path. |
drawString(String str, float x, float y) | Draws a string at the specified position. |
PdfDevice(OutputStream stream)
public PdfDevice(OutputStream stream)
Creates the new instance.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The output stream containing PDF. |
PdfDevice(OutputStream stream, Dimension pageSize)
public PdfDevice(OutputStream stream, Dimension pageSize)
Creates the new instance with specified media size.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The output stream containing PDF. |
pageSize | java.awt.Dimension | The size of the device output media. |
renew()
public void renew()
Sets the devices to the initial state.
setSaveOptions(SaveOptions value)
public void setSaveOptions(SaveOptions value)
Initializes save options.
Parameters:
Parameter | Type | Description |
---|---|---|
value | SaveOptions | Save options. |
getSize()
public Dimension getSize()
Gets the device media size.
Returns: java.awt.Dimension - The device media size.
setSize(Dimension value)
public void setSize(Dimension value)
Sets the device media size.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Dimension | The device media size. |
getBackground()
public Color getBackground()
Gets the background color.
Returns: java.awt.Color - The background color.
setBackground(Color value)
public void setBackground(Color value)
Sets the background color.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The background color. |
getOpacity()
public float getOpacity()
Gets the opacity.
Returns: float - The opacity.
setOpacity(float value)
public void setOpacity(float value)
Sets the opacity.
Parameters:
Parameter | Type | Description |
---|---|---|
value | float | The opacity. |
getStroke()
public Stroke getStroke()
Gets the stroke for drawing paths.
Returns: java.awt.Stroke - The stroke for drawing paths.
setStroke(Stroke value)
public void setStroke(Stroke value)
Sets the stroke for drawing paths.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Stroke | The stroke for drawing paths. |
getPaint()
public Paint getPaint()
Gets the brush for filling paths.
Returns: java.awt.Paint - The brush for filling paths.
setPaint(Paint value)
public void setPaint(Paint value)
Sets the brush for filling paths.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Paint | The brush for filling paths. |
getOpacityMask()
public Paint getOpacityMask()
Gets the brush for opacity mask. The mask applies over Paint or Strike.
Returns: java.awt.Paint - The brush for opacity mask.
setOpacityMask(Paint value)
public void setOpacityMask(Paint value)
Gets the brush for opacity mask. The mask applies over Paint or Strike.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Paint | The brush for opacity mask. |
getFont()
public ITrFont getFont()
Gets the current font.
Returns: ITrFont - The current font.
setFont(ITrFont value)
public void setFont(ITrFont value)
Sets the current font.
Parameters:
Parameter | Type | Description |
---|---|---|
value | ITrFont | The current font. |
startDocument()
public void startDocument()
Starts the document.
endDocument()
public void endDocument()
Accomplishes the document.
reset()
public void reset()
Resets the device.
initPageNumbers()
public void initPageNumbers()
Initializes numbers of pages to output.
openPage(String title)
public boolean openPage(String title)
Starts a new page with the specifies title.
Parameters:
Parameter | Type | Description |
---|---|---|
title | java.lang.String | The title. |
Returns: boolean - True if started page is to be output (it’s number is contained in PageNumbers save options). False , otherwise.
openPage(float width, float height)
public boolean openPage(float width, float height)
Starts a new page with the specified width and height.
Parameters:
Parameter | Type | Description |
---|---|---|
width | float | The width of the page. |
height | float | The height of the page. |
Returns: boolean - True if started page is to be output (it’s number is contained in PageNumbers save options). False , otherwise.
closePage()
public void closePage()
Accomplishes the page.
updatePageParameters(IMultiPageDevice device)
public void updatePageParameters(IMultiPageDevice device)
Updates the current page parameters.
Parameters:
Parameter | Type | Description |
---|---|---|
device | IMultiPageDevice | The multipage device. |
getCurrentPageNumber()
public int getCurrentPageNumber()
Returns the absolute number of the current page within the document.
Returns: int - The absolute number of the current page.
getCurrentRelativePageNumber()
public int getCurrentRelativePageNumber()
Returns the relative number of the current page within the current partition.
Returns: int - The relative number of the current page.
openPartition()
public void openPartition()
Starts a new document partition.
closePartition()
public void closePartition()
Accomplished the document partition.
setHyperlinkTarget(String targetUri)
public void setHyperlinkTarget(String targetUri)
Sets the hyperlink with an external URI as its target.
Parameters:
Parameter | Type | Description |
---|---|---|
targetUri | java.lang.String | The target external URI. |
setHyperlinkTarget(int targetPageNumber)
public void setHyperlinkTarget(int targetPageNumber)
Sets the hyperlink with a page number as its target.
Parameters:
Parameter | Type | Description |
---|---|---|
targetPageNumber | int | The target page number. |
addOutline(int outlineLevel, String description)
public void addOutline(int outlineLevel, String description)
Adds an outline item with the last object as its target.
Parameters:
Parameter | Type | Description |
---|---|---|
outlineLevel | int | The outline level. |
description | java.lang.String | The item description. |
addOutline(Point2D origin, int outlineLevel, String description)
public void addOutline(Point2D origin, int outlineLevel, String description)
Adds an outline item with the origin point as its target.
Parameters:
Parameter | Type | Description |
---|---|---|
origin | java.awt.geom.Point2D | The target origin. |
outlineLevel | int | The outline level. |
description | java.lang.String | 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.
Returns: Device - 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 .
getTransform()
public AffineTransform getTransform()
Returns the current transformation matrix.
Returns: java.awt.geom.AffineTransform - The current transformation matrix.
setTransform(AffineTransform transform)
public void setTransform(AffineTransform transform)
Sets the current transformation matrix.
Parameters:
Parameter | Type | Description |
---|---|---|
transform | java.awt.geom.AffineTransform | The new transformation matrix. |
transform(AffineTransform transform)
public void transform(AffineTransform transform)
Multiplies the current transformation matrix by the specified Matrix .
Parameters:
Parameter | Type | Description |
---|---|---|
transform | java.awt.geom.AffineTransform | The matrix by which the current transformation matrix is to be multiplied. |
translate(double x, double y)
public void translate(double x, double y)
Applies the specified translation vector to the current transformation matrix.
Parameters:
Parameter | Type | Description |
---|---|---|
x | double | The x offset. |
y | double | The y offset. |
rotate(double theta)
public void rotate(double theta)
Applies a clockwise rotation about the origin to the current transformation matrix.
Parameters:
Parameter | Type | Description |
---|---|---|
theta | double | The angle of the rotation, in radians. |
scale(double x, double y)
public void scale(double x, double y)
Applies the specified scale vector to the current transformation matrix.
Parameters:
Parameter | Type | Description |
---|---|---|
x | double | The x scale factor. |
y | double | The y scale factor. |
shear(double shx, double shy)
public void shear(double shx, double shy)
Applies the specified shear vector to the current transformation matrix.
Parameters:
Parameter | Type | Description |
---|---|---|
shx | double | The x shear factor. |
shy | double | The y shear factor. |
setClip(Shape clipPath)
public void setClip(Shape clipPath)
Adds the specified path to the current clip path.
Parameters:
Parameter | Type | Description |
---|---|---|
clipPath | java.awt.Shape | The clip path to be added. |
draw(Shape path)
public void draw(Shape path)
Draws the specified path.
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.awt.Shape | The path to draw. |
fill(Shape path)
public void fill(Shape path)
Fills the specified path.
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.awt.Shape | The path to fill. |
drawString(String str, float x, float y)
public void drawString(String str, float x, float y)
Draws a string at the specified position.
Parameters:
Parameter | Type | Description |
---|---|---|
str | java.lang.String | The text. |
x | float | The x-coordinate of the string position. |
y | float | The y-coordinate of the string position. |