PdfDevice
Inheritance: java.lang.Object, com.aspose.page.Device
All Implemented Interfaces: com.aspose.page.IMultiPageDevice, com.aspose.page.IStreamable
public final class PdfDevice extends Device implements IMultiPageDevice, IStreamable
This class encapsulates rendering of document to PDF.
Constructors
Constructor | Description |
---|---|
PdfDevice(OutputStream ros) | Initializes new instance of PdfDevice with an output stream. |
PdfDevice(OutputStream ros, Dimension size) | Initializes new instance of PdfDevice with an output stream. |
Fields
Field | Description |
---|---|
AUTHOR | “Author” property key. |
BACKGROUND | “Background” property key. |
BACKGROUND_COLOR | “Background color” property key. |
COMPRESS | “Compress” property key. |
CREATOR | |
DEFAULT_SIZE | |
EMBED_FONTS | “Embed font in document” property key. |
EMBED_FONTS_AS | “What font type is used for embedding” property key. |
EMIT_ERRORS | “Emit errors” property key. |
EMIT_WARNINGS | “Emit warnings” property key. |
FIT_TO_PAGE | “Fit content to page” property key. |
KEYWORDS | “Keywords” property key. |
ORIENTATION | “Orientation” property key. |
PAGE_MARGINS | “Page margins” property key. |
PAGE_SIZE | “Page size” property key. |
PRODUCER | “Producer” property key. |
SUBJECT | “Subject” property key. |
TITLE | “Title” property key. |
TRANSPARENT | “Transparent” property key. |
VERSION | “Version” property key. |
VERSION | Current device version. |
VERSION5 | “Version of Adobe Acrobat Reader” property value. |
WRITE_IMAGES_AS | “Format of images” property key. |
Methods
PdfDevice(OutputStream ros)
public PdfDevice(OutputStream ros)
Initializes new instance of PdfDevice with an output stream.
Parameters:
Parameter | Type | Description |
---|---|---|
ros | java.io.OutputStream | An output stream. |
PdfDevice(OutputStream ros, Dimension size)
public PdfDevice(OutputStream ros, Dimension size)
Initializes new instance of PdfDevice with an output stream.
Parameters:
Parameter | Type | Description |
---|---|---|
ros | java.io.OutputStream | An output stream. |
size | java.awt.Dimension | Page size. |
AUTHOR
public static final String AUTHOR
“Author” property key.
BACKGROUND
public static final String BACKGROUND
“Background” property key.
BACKGROUND_COLOR
public static final String BACKGROUND_COLOR
“Background color” property key.
COMPRESS
public static final String COMPRESS
“Compress” property key.
CREATOR
public static final String CREATOR
DEFAULT_SIZE
public static final Dimension DEFAULT_SIZE
EMBED_FONTS
public static final String EMBED_FONTS
“Embed font in document” property key.
EMBED_FONTS_AS
public static final String EMBED_FONTS_AS
“What font type is used for embedding” property key.
EMIT_ERRORS
public static final String EMIT_ERRORS
“Emit errors” property key.
EMIT_WARNINGS
public static final String EMIT_WARNINGS
“Emit warnings” property key.
FIT_TO_PAGE
public static final String FIT_TO_PAGE
“Fit content to page” property key.
KEYWORDS
public static final String KEYWORDS
“Keywords” property key.
ORIENTATION
public static final String ORIENTATION
“Orientation” property key.
PAGE_MARGINS
public static final String PAGE_MARGINS
“Page margins” property key.
PAGE_SIZE
public static final String PAGE_SIZE
“Page size” property key.
PRODUCER
public static final String PRODUCER
“Producer” property key.
SUBJECT
public static final String SUBJECT
“Subject” property key.
TITLE
public static final String TITLE
“Title” property key.
TRANSPARENT
public static final String TRANSPARENT
“Transparent” property key.
VERSION
public static final String VERSION
“Version” property key.
VERSION
public static String VERSION
Current device version.
VERSION5
public static final String VERSION5
“Version of Adobe Acrobat Reader” property value.
WRITE_IMAGES_AS
public static final String WRITE_IMAGES_AS
“Format of images” property key.
clip(Shape s)
public void clip(Shape s)
Clips using given shape. Dispatches to writeClip(Rectangle), writeClip(Rectangle2D) or writeClip(Shape).
Parameters:
Parameter | Type | Description |
---|---|---|
s | java.awt.Shape | Shape used for clipping. |
clipRect(float x, float y, float width, float height)
public void clipRect(float x, float y, float width, float height)
Clips rectangle. Calls clip(Rectangle2D).
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | The x-coordinate. |
y | float | The y-coordinate. |
width | float | The rectangle width. |
height | float | The rectangle height. |
closePage()
public final void closePage()
Makes necessary preparation of the device after page has been rendered.
create()
public Device create()
Creates a copy of this device.
Returns: Device - Copy of this device.
dispose()
public void dispose()
Disposes the graphics context. If on creation restoreOnDispose was true, writeGraphicsRestore() will be called.
draw(Shape s)
public void draw(Shape s)
Draws a path.
Parameters:
Parameter | Type | Description |
---|---|---|
s | java.awt.Shape | A path to be drawn. |
drawArc(float x, float y, float width, float height, float startAngle, float arcAngle)
public void drawArc(float x, float y, float width, float height, float startAngle, float arcAngle)
Draws an arc.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of center of the arc. |
y | float | Y coordinate of center of the arc. |
width | float | A width of circumscribed rectangle. |
height | float | A height of circumscribed rectangle. |
startAngle | float | A start angle of the arc. |
arcAngle | float | An angle of the arc. |
drawImage(BufferedImage image, AffineTransform transform, Color bkg)
public void drawImage(BufferedImage image, AffineTransform transform, Color bkg)
Draws an image with assigned transform and background.
Parameters:
Parameter | Type | Description |
---|---|---|
image | java.awt.image.BufferedImage | An image to be drawn. |
transform | java.awt.geom.AffineTransform | A transform. |
bkg | java.awt.Color | A background color. |
drawLine(float x1, float y1, float x2, float y2)
public void drawLine(float x1, float y1, float x2, float y2)
Draws a line segment.
Parameters:
Parameter | Type | Description |
---|---|---|
x1 | float | X coordinate of the beginning of segment. |
y1 | float | Y coordinate of the beginning of segment. |
x2 | float | X coordinate of the end of segment. |
y2 | float | Y coordinate of the end of segment. |
drawOval(float x, float y, float width, float height)
public void drawOval(float x, float y, float width, float height)
Draws an oval.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of center of the oval. |
y | float | Y coordinate of center of the oval. |
width | float | A width of circumscribed rectangle. |
height | float | A height of circumscribed rectangle. |
drawPolygon(float[] xPoints, float[] yPoints, int nPoints)
public void drawPolygon(float[] xPoints, float[] yPoints, int nPoints)
Draws a polygon.
Parameters:
Parameter | Type | Description |
---|---|---|
xPoints | float[] | X coordinates of points. |
yPoints | float[] | Y coordinate of points. |
nPoints | int | The number of points. |
drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Draws a polygon.
Parameters:
Parameter | Type | Description |
---|---|---|
xPoints | int[] | X coordinates of points. |
yPoints | int[] | Y coordinate of points. |
nPoints | int | The number of points. |
drawPolyline(float[] xPoints, float[] yPoints, int nPoints)
public void drawPolyline(float[] xPoints, float[] yPoints, int nPoints)
Draws a polyline.
Parameters:
Parameter | Type | Description |
---|---|---|
xPoints | float[] | X coordinates of points. |
yPoints | float[] | Y coordinate of points. |
nPoints | int | The number of points. |
drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
Draws a polyline.
Parameters:
Parameter | Type | Description |
---|---|---|
xPoints | int[] | X coordinates of points. |
yPoints | int[] | Y coordinate of points. |
nPoints | int | The number of points. |
drawRect(float x, float y, float width, float height)
public void drawRect(float x, float y, float width, float height)
Draws a rectangle.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of upper left corner of the rectangle. |
y | float | Y coordinate of upper left corner of the rectangle. |
width | float | A width of the rectangle. |
height | float | A height of the rectangle. |
drawRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
public void drawRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
Draws a round rectangle.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of upper left corner of the rectangle. |
y | float | Y coordinate of upper left corner of the rectangle. |
width | float | A width of the rectangle. |
height | float | A height of the rectangle. |
arcWidth | float | A width of circumscribed rectangle of the arc that rounds an angle of the rectangle. |
arcHeight | float | A height of circumscribed rectangle of the arc that rounds an angle of the rectangle. |
drawString(String str, float x, float y)
public void drawString(String str, float x, float y)
Draws a string at given point.
Parameters:
Parameter | Type | Description |
---|---|---|
str | java.lang.String | A string to be drawn. |
x | float | X coordinate of point. |
y | float | Y coordinate of point. |
endDocument()
public void endDocument()
Makes necessary preparation of device after the document has been rendered.
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
fill(Shape s)
public void fill(Shape s)
Fills a path.
Parameters:
Parameter | Type | Description |
---|---|---|
s | java.awt.Shape | A path to be filled. |
fillArc(float x, float y, float width, float height, float startAngle, float arcAngle)
public void fillArc(float x, float y, float width, float height, float startAngle, float arcAngle)
Fills an arc.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of center of the arc. |
y | float | Y coordinate of center of the arc. |
width | float | A width of circumscribed rectangle. |
height | float | A height of circumscribed rectangle. |
startAngle | float | A start angle of the arc. |
arcAngle | float | An angle of the arc. |
fillOval(float x, float y, float width, float height)
public void fillOval(float x, float y, float width, float height)
Fills an oval.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of center of the oval. |
y | float | Y coordinate of center of the oval. |
width | float | A width of circumscribed rectangle. |
height | float | A height of circumscribed rectangle. |
fillPolygon(float[] xPoints, float[] yPoints, int nPoints)
public void fillPolygon(float[] xPoints, float[] yPoints, int nPoints)
Fills a polygon.
Parameters:
Parameter | Type | Description |
---|---|---|
xPoints | float[] | X coordinates of points. |
yPoints | float[] | Y coordinate of points. |
nPoints | int | The number of points. |
fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Fills a polygon.
Parameters:
Parameter | Type | Description |
---|---|---|
xPoints | int[] | X coordinates of points. |
yPoints | int[] | Y coordinate of points. |
nPoints | int | The number of points. |
fillRect(float x, float y, float width, float height)
public void fillRect(float x, float y, float width, float height)
Fills a rectangle.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of upper left corner of the rectangle. |
y | float | Y coordinate of upper left corner of the rectangle. |
width | float | A width of the rectangle. |
height | float | A height of the rectangle. |
fillRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
public void fillRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
Draws a round rectangle.
Parameters:
Parameter | Type | Description |
---|---|---|
x | float | X coordinate of upper left corner of the rectangle. |
y | float | Y coordinate of upper left corner of the rectangle. |
width | float | A width of the rectangle. |
height | float | A height of the rectangle. |
arcWidth | float | A width of circumscribed rectangle of the arc that rounds an angle of the rectangle. |
arcHeight | float | A height of circumscribed rectangle of the arc that rounds an angle of the rectangle. |
getBackground()
public Color getBackground()
Gets current background of the page.
Returns: java.awt.Color - Current background of the page
getCharTM()
public AffineTransform getCharTM()
Gets current characters transform.
Returns: java.awt.geom.AffineTransform - Current characters transform.
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getCreator()
public String getCreator()
Gets creator of resulting device output.
Returns: java.lang.String - A creator value.
getCurrentPageNumber()
public int getCurrentPageNumber()
Gets current page number.
Returns: int - The number of current page.
getFont()
public ITrFont getFont()
Gets current font.
Returns: ITrFont - Current font.
getOpacity()
public float getOpacity()
Gets current opacity.
Returns: float - Current opacity.
getOpacityMask()
public Paint getOpacityMask()
Gets current opacity mask.
Returns: java.awt.Paint - Current opacity mask.
getOutputStream()
public OutputStream getOutputStream()
Gets an output stream.
Returns: java.io.OutputStream - An output stream.
getPaint()
public Paint getPaint()
Gets current paint.
Returns: java.awt.Paint - Current paint.
getProperties()
public UserProperties getProperties()
Gets device properties including metadata.
Returns: UserProperties - Device properties.
getProperty(String key)
public String getProperty(String key)
Gets a value of string property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: java.lang.String - The property value.
getPropertyColor(String key)
public Color getPropertyColor(String key)
Gets a value of color property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: java.awt.Color - The property value.
getPropertyDouble(String key)
public double getPropertyDouble(String key)
Gets a value of double property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: double - The property value.
getPropertyInt(String key)
public int getPropertyInt(String key)
Gets a value of integer property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: int - The property value.
getPropertyMargins(String key)
public Insets getPropertyMargins(String key)
Gets a value of margins property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: java.awt.Insets - The property value.
getPropertyMatrix(String key)
public AffineTransform getPropertyMatrix(String key)
Gets a value of matrix property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: java.awt.geom.AffineTransform - The property value.
getPropertyRectangle(String key)
public Rectangle getPropertyRectangle(String key)
Gets a value of rectangle property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: java.awt.Rectangle - The property value.
getPropertySize(String key)
public Dimension getPropertySize(String key)
Gets a value of size property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: java.awt.Dimension - The property value.
getSaveOptions()
public SaveOptions getSaveOptions()
Returns save options.
Returns: SaveOptions - The save options.
getSize()
public Dimension getSize()
Gets a size of the page.
Returns: java.awt.Dimension - Size of page.
getStroke()
public Stroke getStroke()
Gets current stroke.
Returns: java.awt.Stroke - Current stroke.
getTextRenderingMode()
public TextRenderingMode getTextRenderingMode()
Gets current text rendering mode.
Returns: TextRenderingMode - Current text rendering mode.
getTextStrokeWidth()
public float getTextStrokeWidth()
Gets current text stroke width.
Returns: float - Current text stroke width.
getTransform()
public AffineTransform getTransform()
Gets the current transform.
Returns: java.awt.geom.AffineTransform - Current transform.
hashCode()
public native int hashCode()
Returns: int
initClip()
public void initClip()
Initializes clip of the device.
initPageNumbers()
public void initPageNumbers()
Initializes numbers of pages to output.
isDirectRGB()
public boolean isDirectRGB()
Indicates whether device uses direct RGB mode, that is RGB.
Returns: boolean - True if direct RGB mode and false otherwise, that is BGR.
isMainDocument()
public boolean isMainDocument()
Returns: boolean
isProperty(String key)
public boolean isProperty(String key)
Gets a value of boolean property.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The name of property. |
Returns: boolean - The property value.
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
openPage(float width, float height)
public boolean openPage(float width, float height)
Makes necessary preparation of the device before page rendering.
Parameters:
Parameter | Type | Description |
---|---|---|
width | float | A width of the page. |
height | float | A height of the page. |
Returns: boolean - Always true.
openPage(String title)
public boolean openPage(String title)
Makes necessary preparation of the device before page rendering.
Parameters:
Parameter | Type | Description |
---|---|---|
title | java.lang.String | The page title. |
Returns: boolean - Always true.
renew()
public void renew()
Reset device to initial state for whole document. Used for reseting output stream.
renewForMerge(boolean mainDocument)
public void renewForMerge(boolean mainDocument)
Parameters:
Parameter | Type | Description |
---|---|---|
mainDocument | boolean |
reset()
public void reset()
If page device parameters will be set this method allows to return writing stream back the begining of page.
rotate(double theta)
public void rotate(double theta)
Rotate the current transform over the Z-axis. Calls writeTransform(Transform). Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.
Parameters:
Parameter | Type | Description |
---|---|---|
theta | double | Radians over which to rotate. |
rotate(double theta, double x, double y)
public void rotate(double theta, double x, double y)
Rotate the current transformation matrix around a point.
Parameters:
Parameter | Type | Description |
---|---|---|
theta | double | An angle of rotation in radians. |
x | double | X coordinate of point. |
y | double | Y coordinate of point. |
savePageTransform()
public void savePageTransform()
scale(double sx, double sy)
public void scale(double sx, double sy)
Scales the current transformation matrix. Calls writeTransform(Transform).
Parameters:
Parameter | Type | Description |
---|---|---|
sx | double | A scale in X axis. |
sy | double | A scale in Y axis. |
setBackground(Color background)
public void setBackground(Color background)
Specifies current background of the page.
Parameters:
Parameter | Type | Description |
---|---|---|
background | java.awt.Color | A background of the page. |
setCharTM(AffineTransform charTM)
public void setCharTM(AffineTransform charTM)
Specifies characters transform.
Parameters:
Parameter | Type | Description |
---|---|---|
charTM | java.awt.geom.AffineTransform | \u0421haracters transform. |
setClip(Shape path)
public void setClip(Shape path)
Specifies clip shape.
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.awt.Shape | Path that is used for clipping. |
setCreator(String creator)
public void setCreator(String creator)
Specifies creator of resulting device output.
Parameters:
Parameter | Type | Description |
---|---|---|
creator | java.lang.String | A creator value. |
setFont(ITrFont font)
public void setFont(ITrFont font)
Specifies current font.
Parameters:
Parameter | Type | Description |
---|---|---|
font | ITrFont | A font. |
setOpacity(float opacity)
public void setOpacity(float opacity)
Specifies opacity.
Parameters:
Parameter | Type | Description |
---|---|---|
opacity | float | An opacity. |
setOpacityMask(Paint opacityMask)
public void setOpacityMask(Paint opacityMask)
Specifies a opacity mask.
Parameters:
Parameter | Type | Description |
---|---|---|
opacityMask | java.awt.Paint | A opacity mask. |
setOutputStream(OutputStream os)
public void setOutputStream(OutputStream os)
Specifies an output stream.
Parameters:
Parameter | Type | Description |
---|---|---|
os | java.io.OutputStream | An output stream. |
setPaint(Paint paint)
public void setPaint(Paint paint)
Specifies current paint.
Parameters:
Parameter | Type | Description |
---|---|---|
paint | java.awt.Paint | A paint. |
setProperties(UserProperties props)
public void setProperties(UserProperties props)
Specifies device properties including metadata.
Parameters:
Parameter | Type | Description |
---|---|---|
props | UserProperties | Device properties. |
setProperties(Properties props)
public void setProperties(Properties props)
Specifies device properties including metadata.
Parameters:
Parameter | Type | Description |
---|---|---|
props | java.util.Properties | Device properties. |
setSaveFromPatternCreate()
public void setSaveFromPatternCreate()
setSaveOptions(SaveOptions options)
public void setSaveOptions(SaveOptions options)
Specifies options for managing rendering process.
Parameters:
Parameter | Type | Description |
---|---|---|
options | SaveOptions | Options for managing rendering process. |
setSize(Dimension size)
public void setSize(Dimension size)
Specifies size of page.
Parameters:
Parameter | Type | Description |
---|---|---|
size | java.awt.Dimension | Size of page. |
setStroke(Stroke stroke)
public void setStroke(Stroke stroke)
Specifies a stroke.
Parameters:
Parameter | Type | Description |
---|---|---|
stroke | java.awt.Stroke | A stroke. |
setTextRenderingMode(TextRenderingMode textRenderingMode)
public void setTextRenderingMode(TextRenderingMode textRenderingMode)
Specifies text rendering mode.
Parameters:
Parameter | Type | Description |
---|---|---|
textRenderingMode | TextRenderingMode | Text rendering mode. |
setTextStrokeWidth(float textStrokeWidth)
public void setTextStrokeWidth(float textStrokeWidth)
Specifies text stroke width.
Parameters:
Parameter | Type | Description |
---|---|---|
textStrokeWidth | float | Text stroke width. |
setTransform(AffineTransform transform)
public void setTransform(AffineTransform transform)
Specifies the current transform. Since most output formats do not implement this functionality, the inverse transform of the currentTransform is calculated and multiplied by the transform to be set. The result is then forwarded by a call to writeTransform(Transform).
Parameters:
Parameter | Type | Description |
---|---|---|
transform | java.awt.geom.AffineTransform | Transform to be applied. |
shear(double shx, double shy)
public void shear(double shx, double shy)
Shears the current transformation matrix. Calls writeTransform(Transform).
Parameters:
Parameter | Type | Description |
---|---|---|
shx | double | A shear in X axis. |
shy | double | A shear in Y axis. |
startDocument()
public void startDocument()
Makes necessary preparation of device before start rendering of document.
toString()
public String toString()
Returns the name of device type.
Returns: java.lang.String - Type name.
transform(AffineTransform transform)
public void transform(AffineTransform transform)
Transforms the current transform. Calls writeTransform(Transform)
Parameters:
Parameter | Type | Description |
---|---|---|
transform | java.awt.geom.AffineTransform | Transform to be applied. |
translate(double x, double y)
public void translate(double x, double y)
Translates the current transformation matrix. Calls writeTransform(Transform).
Parameters:
Parameter | Type | Description |
---|---|---|
x | double | Translation in X axis. |
y | double | Translation in Y axis. |
updatePageParameters(IMultiPageDevice device)
public void updatePageParameters(IMultiPageDevice device)
Updates page parameters from other multi-paged device.
Parameters:
Parameter | Type | Description |
---|---|---|
device | IMultiPageDevice | Another instance of the same device. |
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |
writeComment(String comment)
public void writeComment(String comment)
Writes a comment.
Parameters:
Parameter | Type | Description |
---|---|---|
comment | java.lang.String | A comment to be written. |
writeString(ITrFont font, String str)
public void writeString(ITrFont font, String str)
Writes out string with specified font.
Parameters:
Parameter | Type | Description |
---|---|---|
font | ITrFont | Specified font. |
str | java.lang.String | The string. |