public class PdfDevice extends DeviceXps implements IMultiPartitionDevice, IInteractiveDevice
Class incapsulating image composing device.
Constructor and Description |
---|
PdfDevice(OutputStream stream)
Creates the new instance.
|
PdfDevice(OutputStream stream,
Dimension pageSize)
Creates the new instance with specified media size.
|
Modifier and Type | Method and Description |
---|---|
void |
addOutline(int outlineLevel,
String description)
Adds an outline item with the last object as its target.
|
void |
addOutline(Point2D origin,
int outlineLevel,
String description)
Adds an outline item with the origin point as its target.
|
void |
closePage()
Accomplishes the page.
|
void |
closePartition()
Accomplished the document partition.
|
Device |
create()
Creates a new instance of the device based on this device instance.
|
void |
dispose()
Disposes this device instance.
|
void |
draw(Shape path)
Draws the specified path.
|
void |
drawString(String str,
float x,
float y)
Draws a string at the specified position.
|
void |
endDocument()
Accomplishes the document.
|
void |
fill(Shape path)
Fills the specified path.
|
Color |
getBackground()
Gets the background color.
|
int |
getCurrentPageNumber()
Returns the absolute number of the current page within the document.
|
int |
getCurrentRelativePageNumber()
Returns the relative number of the current page within the current partition.
|
ITrFont |
getFont()
Gets the current font.
|
float |
getOpacity()
Gets the opacity.
|
Paint |
getOpacityMask()
Gets the brush for opacity mask.
|
Paint |
getPaint()
Gets the brush for filling paths.
|
Dimension |
getSize()
Gets the device media size.
|
Stroke |
getStroke()
Gets the stroke for drawing paths.
|
AffineTransform |
getTransform()
Returns the current transformation matrix.
|
void |
initPageNumbers()
Initializes numbers of pages to output.
|
boolean |
openPage(float width,
float height)
Starts a new page with the specified width and height.
|
boolean |
openPage(String title)
Starts a new page with the specifies title.
|
void |
openPartition()
Starts a new document partition.
|
void |
renew()
Sets the devices to the initial state.
|
void |
reset()
Resets the device.
|
void |
rotate(double theta)
Applies a clockwise rotation about the origin to the current transformation matrix.
|
void |
scale(double x,
double y)
Applies the specified scale vector to the current transformation matrix.
|
void |
setBackground(Color value)
Sets the background color.
|
void |
setClip(Shape clipPath)
Adds the specified path to the current clip path.
|
void |
setFont(ITrFont value)
Sets the current font.
|
void |
setHyperlinkTarget(int targetPageNumber)
Sets the hyperlink with a page number as its target.
|
void |
setHyperlinkTarget(String targetUri)
Sets the hyperlink with an external URI as its target.
|
void |
setOpacity(float value)
Sets the opacity.
|
void |
setOpacityMask(Paint value)
Gets the brush for opacity mask.
|
void |
setPaint(Paint value)
Sets the brush for filling paths.
|
void |
setSaveOptions(SaveOptions value)
Initializes save options.
|
void |
setSize(Dimension value)
Sets the device media size.
|
void |
setStroke(Stroke value)
Sets the stroke for drawing paths.
|
void |
setTransform(AffineTransform transform)
Sets the current transformation matrix.
|
void |
shear(double shx,
double shy)
Applies the specified shear vector to the current transformation matrix.
|
void |
startDocument()
Starts the document.
|
void |
transform(AffineTransform transform)
Multiplies the current transformation matrix by the specified
Matrix . |
void |
translate(double x,
double y)
Applies the specified translation vector to the current transformation matrix.
|
void |
updatePageParameters(IMultiPageDevice device)
Updates the current page parameters.
|
drawArc, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawPolyline, drawRect, drawRoundRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, getCharTM, getCreator, getProperties, getProperty, getPropertyColor, getPropertyDouble, getPropertyInt, getPropertyMargins, getPropertyRectangle, getPropertySize, getTextRenderingMode, getTextStrokeWidth, initClip, isDirectRGB, isLicensed, isProperty, rotate, setCharTM, setCreator, setProperties, setTextRenderingMode, setTextStrokeWidth, toString, writeComment, writeString
public PdfDevice(OutputStream stream)
Creates the new instance.
stream
- The output stream containing PDF.public PdfDevice(OutputStream stream, Dimension pageSize)
Creates the new instance with specified media size.
stream
- The output stream containing PDF.pageSize
- The size of the device output media.public void setSaveOptions(SaveOptions value)
Initializes save options.
setSaveOptions
in class Device
value
- Save options.public Dimension getSize()
Gets the device media size.
public void setSize(Dimension value)
Sets the device media size.
public Color getBackground()
Gets the background color.
getBackground
in class Device
public void setBackground(Color value)
Sets the background color.
setBackground
in class Device
value
- The background color.public float getOpacity()
Gets the opacity.
getOpacity
in class Device
public void setOpacity(float value)
Sets the opacity.
setOpacity
in class Device
value
- The opacity.public Stroke getStroke()
Gets the stroke for drawing paths.
public void setStroke(Stroke value)
Sets the stroke for drawing paths.
public Paint getPaint()
Gets the brush for filling paths.
public void setPaint(Paint value)
Sets the brush for filling paths.
public Paint getOpacityMask()
Gets the brush for opacity mask. The mask applies over Paint or Strike.
getOpacityMask
in class Device
public void setOpacityMask(Paint value)
Gets the brush for opacity mask. The mask applies over Paint or Strike.
setOpacityMask
in class Device
value
- The brush for opacity mask.public ITrFont getFont()
Gets the current font.
public void setFont(ITrFont value)
Sets the current font.
public void startDocument()
Starts the document.
startDocument
in class Device
public void endDocument()
Accomplishes the document.
endDocument
in class Device
public void initPageNumbers()
Initializes numbers of pages to output.
initPageNumbers
in interface IMultiPageDevice
public boolean openPage(String title)
Starts a new page with the specifies title.
openPage
in interface IMultiPageDevice
title
- The title.True
if started page is to be output (it's number is contained in PageNumbers save options).
False
, otherwise.public boolean openPage(float width, float height)
Starts a new page with the specified width and height.
openPage
in interface IMultiPageDevice
width
- The width of the page.height
- The height of the page.True
if started page is to be output (it's number is contained in PageNumbers save options).
False
, otherwise.public void closePage()
Accomplishes the page.
closePage
in interface IMultiPageDevice
public void updatePageParameters(IMultiPageDevice device)
Updates the current page parameters.
updatePageParameters
in interface IMultiPageDevice
device
- The multipage device.public int getCurrentPageNumber()
Returns the absolute number of the current page within the document.
getCurrentPageNumber
in interface IMultiPageDevice
public int getCurrentRelativePageNumber()
Returns the relative number of the current page within the current partition.
getCurrentRelativePageNumber
in interface IMultiPartitionDevice
public void openPartition()
Starts a new document partition.
openPartition
in interface IMultiPartitionDevice
public void closePartition()
Accomplished the document partition.
closePartition
in interface IMultiPartitionDevice
public void setHyperlinkTarget(String targetUri)
Sets the hyperlink with an external URI as its target.
setHyperlinkTarget
in interface IInteractiveDevice
targetUri
- The target external URI.public void setHyperlinkTarget(int targetPageNumber)
Sets the hyperlink with a page number as its target.
setHyperlinkTarget
in interface IInteractiveDevice
targetPageNumber
- The target page number.public void addOutline(int outlineLevel, String description)
Adds an outline item with the last object as its target.
addOutline
in interface IInteractiveDevice
outlineLevel
- The outline level.description
- The item description.public void addOutline(Point2D origin, int outlineLevel, String description)
Adds an outline item with the origin point as its target.
addOutline
in interface IInteractiveDevice
origin
- The target origin.outlineLevel
- The outline level.description
- The item description.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.
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
.
public AffineTransform getTransform()
Returns the current transformation matrix.
getTransform
in class Device
public void setTransform(AffineTransform transform)
Sets the current transformation matrix.
setTransform
in class Device
transform
- The new transformation matrix.public void transform(AffineTransform transform)
Multiplies the current transformation matrix by the specified Matrix
.
public void translate(double x, double y)
Applies the specified translation vector to the current transformation matrix.
public void rotate(double theta)
Applies a clockwise rotation about the origin to the current transformation matrix.
public void scale(double x, double y)
Applies the specified scale vector to the current transformation matrix.
public void shear(double shx, double shy)
Applies the specified shear vector to the current transformation matrix.
public void setClip(Shape clipPath)
Adds the specified path to the current clip path.
public void draw(Shape path)
Draws the specified path.
public void fill(Shape path)
Fills the specified path.
public void drawString(String str, float x, float y)
drawString
in class Device
str
- The text.x
- The x-coordinate of the string position.y
- The y-coordinate of the string position.