Package org.apache.pdfbox.pdmodel.edit
Class PDPageContentStream
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.edit.PDPageContentStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class PDPageContentStream extends java.lang.Object implements java.io.CloseableThis class is a convenience for creating page content streams. You MUST call close() when you are finished with this object.- Author:
- Ben Litchfield
-
-
Constructor Summary
Constructors Constructor Description PDPageContentStream(PDDocument document, PDPage sourcePage)Create a new PDPage content stream.PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, boolean compress)Create a new PDPage content stream.PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, boolean compress, boolean resetContext)Create a new PDPage content stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBezier31(float x1, float y1, float x3, float y3)Append a cubic Bézier curve to the current path.voidaddBezier312(float x1, float y1, float x2, float y2, float x3, float y3)Append a cubic Bézier curve to the current path.voidaddBezier32(float x2, float y2, float x3, float y3)Append a cubic Bézier curve to the current path.voidaddLine(float xStart, float yStart, float xEnd, float yEnd)add a line to the current path.voidaddPolygon(float[] x, float[] y)Add a polygon to the current path.voidaddRect(float x, float y, float width, float height)Add a rectangle to the current path.voidappendCOSName(COSName name)This will append aCOSNameto the content stream.voidappendRawCommands(byte[] commands)This will append raw commands to the content stream.voidappendRawCommands(double data)This will append raw commands to the content stream.voidappendRawCommands(float data)This will append raw commands to the content stream.voidappendRawCommands(int data)This will append raw commands to the content stream.voidappendRawCommands(java.lang.String commands)This will append raw commands to the content stream.voidbeginMarkedContentSequence(COSName tag)Begin a marked content sequence.voidbeginMarkedContentSequence(COSName tag, COSName propsName)Begin a marked content sequence with a reference to an entry in the page resources' Properties dictionary.voidbeginText()Begin some text operations.voidclipPath(int windingRule)Clip path.voidclose()Close the content stream.voidcloseAndStroke()Close and stroke the path.voidcloseSubPath()Close subpath.voidconcatenate2CTM(double a, double b, double c, double d, double e, double f)The Cm operator.voidconcatenate2CTM(java.awt.geom.AffineTransform at)The Cm operator.voiddrawImage(PDXObjectImage image, float x, float y)Draw an image at the x,y coordinates, with the default size of the image.voiddrawLine(float xStart, float yStart, float xEnd, float yEnd)Draw a line on the page using the current stroking color and the current line width.voiddrawPolygon(float[] x, float[] y)Draw a polygon on the page using the current stroking color.voiddrawString(java.lang.String text)This will draw a string at the current location on the screen.voiddrawXObject(PDXObject xobject, float x, float y, float width, float height)Draw an xobject(form or image) at the x,y coordinates and a certain width and height.voiddrawXObject(PDXObject xobject, java.awt.geom.AffineTransform transform)Draw an xobject(form or image) using the givenAffineTransformto position the xobject.voidendMarkedContentSequence()End a marked content sequence.voidendText()End some text operations.voidfill(int windingRule)Fill the path.voidfillPolygon(float[] x, float[] y)Draw and fill a polygon on the page using the current stroking / non stroking colors.voidfillRect(float x, float y, float width, float height)Fill a rectangle on the page using the current non stroking color.voidlineTo(float x, float y)Add a move to the given coordinate.voidmoveTextPositionByAmount(float x, float y)The Td operator.voidmoveTo(float x, float y)Add a line to the given coordinate.voidrestoreGraphicsState()Q operator.voidsaveGraphicsState()q operator.voidsetFont(PDFont font, float fontSize)Set the font to draw text with.voidsetLineCapStyle(int lineCapStyle)Set the line cap style.voidsetLineDashPattern(float[] pattern, float phase)Set the line dash pattern.voidsetLineJoinStyle(int lineJoinStyle)Set the line join style.voidsetLineWidth(float lineWidth)Set linewidth to the given value.voidsetNonStrokingColor(double g)Set the non stroking color, specified as Grayscale 0.0-1.0.voidsetNonStrokingColor(double c, double m, double y, double k)Set the non stroking color, specified as CMYK, 0.0-1.0.voidsetNonStrokingColor(float[] components)Set the color components of current non stroking colorspace.voidsetNonStrokingColor(int g)Set the non stroking color, specified as grayscale, 0-255.voidsetNonStrokingColor(int r, int g, int b)Set the non stroking color, specified as RGB, 0-255.voidsetNonStrokingColor(int c, int m, int y, int k)Set the non stroking color, specified as CMYK, 0-255.voidsetNonStrokingColor(java.awt.Color color)Set the non stroking color, specified as RGB.voidsetNonStrokingColorSpace(PDColorSpace colorSpace)Set the stroking color space.voidsetStrokingColor(double g)Set the stroking color, specified as Grayscale 0.0-1.0.voidsetStrokingColor(double c, double m, double y, double k)Set the stroking color, specified as CMYK, 0.0-1.0.voidsetStrokingColor(float[] components)Set the color components of current stroking colorspace.voidsetStrokingColor(int g)Set the stroking color, specified as grayscale, 0-255.voidsetStrokingColor(int r, int g, int b)Set the stroking color, specified as RGB, 0-255.voidsetStrokingColor(int c, int m, int y, int k)Set the stroking color, specified as CMYK, 0-255.voidsetStrokingColor(java.awt.Color color)Set the stroking color, specified as RGB.voidsetStrokingColorSpace(PDColorSpace colorSpace)Set the stroking color space.voidsetTextMatrix(double a, double b, double c, double d, double e, double f)The Tm operator.voidsetTextMatrix(java.awt.geom.AffineTransform matrix)The Tm operator.voidsetTextRotation(double angle, double tx, double ty)The Tm operator.voidsetTextScaling(double sx, double sy, double tx, double ty)The Tm operator.voidsetTextTranslation(double tx, double ty)The Tm operator.voidstroke()Stroke the path.
-
-
-
Constructor Detail
-
PDPageContentStream
public PDPageContentStream(PDDocument document, PDPage sourcePage) throws java.io.IOException
Create a new PDPage content stream.- Parameters:
document- The document the page is part of.sourcePage- The page to write the contents to.- Throws:
java.io.IOException- If there is an error writing to the page contents.
-
PDPageContentStream
public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, boolean compress) throws java.io.IOException
Create a new PDPage content stream.- Parameters:
document- The document the page is part of.sourcePage- The page to write the contents to.appendContent- Indicates whether content will be overwritten. If false all previous content is deleted.compress- Tell if the content stream should compress the page contents.- Throws:
java.io.IOException- If there is an error writing to the page contents.
-
PDPageContentStream
public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, boolean compress, boolean resetContext) throws java.io.IOException
Create a new PDPage content stream.- Parameters:
document- The document the page is part of.sourcePage- The page to write the contents to.appendContent- Indicates whether content will be overwritten. If false all previous content is deleted.compress- Tell if the content stream should compress the page contents.resetContext- Tell if the graphic context should be reseted.- Throws:
java.io.IOException- If there is an error writing to the page contents.
-
-
Method Detail
-
beginText
public void beginText() throws java.io.IOExceptionBegin some text operations.- Throws:
java.io.IOException- If there is an error writing to the stream or if you attempt to nest beginText calls.
-
endText
public void endText() throws java.io.IOExceptionEnd some text operations.- Throws:
java.io.IOException- If there is an error writing to the stream or if you attempt to nest endText calls.
-
setFont
public void setFont(PDFont font, float fontSize) throws java.io.IOException
Set the font to draw text with.- Parameters:
font- The font to use.fontSize- The font size to draw the text.- Throws:
java.io.IOException- If there is an error writing the font information.
-
drawImage
public void drawImage(PDXObjectImage image, float x, float y) throws java.io.IOException
Draw an image at the x,y coordinates, with the default size of the image.- Parameters:
image- The image to draw.x- The x-coordinate to draw the image.y- The y-coordinate to draw the image.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
drawXObject
public void drawXObject(PDXObject xobject, float x, float y, float width, float height) throws java.io.IOException
Draw an xobject(form or image) at the x,y coordinates and a certain width and height.- Parameters:
xobject- The xobject to draw.x- The x-coordinate to draw the image.y- The y-coordinate to draw the image.width- The width of the image to draw.height- The height of the image to draw.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
drawXObject
public void drawXObject(PDXObject xobject, java.awt.geom.AffineTransform transform) throws java.io.IOException
Draw an xobject(form or image) using the givenAffineTransformto position the xobject.- Parameters:
xobject- The xobject to draw.transform- the transformation matrix- Throws:
java.io.IOException- If there is an error writing to the stream.
-
moveTextPositionByAmount
public void moveTextPositionByAmount(float x, float y) throws java.io.IOExceptionThe Td operator. A current text matrix will be replaced with a new one (1 0 0 1 x y).- Parameters:
x- The x coordinate.y- The y coordinate.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
setTextMatrix
public void setTextMatrix(double a, double b, double c, double d, double e, double f) throws java.io.IOExceptionThe Tm operator. Sets the text matrix to the given values. A current text matrix will be replaced with the new one.- Parameters:
a- The a value of the matrix.b- The b value of the matrix.c- The c value of the matrix.d- The d value of the matrix.e- The e value of the matrix.f- The f value of the matrix.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
setTextMatrix
public void setTextMatrix(java.awt.geom.AffineTransform matrix) throws java.io.IOExceptionThe Tm operator. Sets the text matrix to the given values. A current text matrix will be replaced with the new one.- Parameters:
matrix- the transformation matrix- Throws:
java.io.IOException- If there is an error writing to the stream.
-
setTextScaling
public void setTextScaling(double sx, double sy, double tx, double ty) throws java.io.IOExceptionThe Tm operator. Sets the text matrix to the given scaling and translation values. A current text matrix will be replaced with the new one.- Parameters:
sx- The scaling factor in x-direction.sy- The scaling factor in y-direction.tx- The translation value in x-direction.ty- The translation value in y-direction.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
setTextTranslation
public void setTextTranslation(double tx, double ty) throws java.io.IOExceptionThe Tm operator. Sets the text matrix to the given translation values. A current text matrix will be replaced with the new one.- Parameters:
tx- The translation value in x-direction.ty- The translation value in y-direction.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
setTextRotation
public void setTextRotation(double angle, double tx, double ty) throws java.io.IOExceptionThe Tm operator. Sets the text matrix to the given rotation and translation values. A current text matrix will be replaced with the new one.- Parameters:
angle- The angle used for the counterclockwise rotation in radians.tx- The translation value in x-direction.ty- The translation value in y-direction.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
concatenate2CTM
public void concatenate2CTM(double a, double b, double c, double d, double e, double f) throws java.io.IOExceptionThe Cm operator. Concatenates the current transformation matrix with the given values.- Parameters:
a- The a value of the matrix.b- The b value of the matrix.c- The c value of the matrix.d- The d value of the matrix.e- The e value of the matrix.f- The f value of the matrix.- Throws:
java.io.IOException- If there is an error writing to the stream.
-
concatenate2CTM
public void concatenate2CTM(java.awt.geom.AffineTransform at) throws java.io.IOExceptionThe Cm operator. Concatenates the current transformation matrix with the givenAffineTransform.- Parameters:
at- the transformation matrix- Throws:
java.io.IOException- If there is an error writing to the stream.
-
drawString
public void drawString(java.lang.String text) throws java.io.IOExceptionThis will draw a string at the current location on the screen.- Parameters:
text- The text to draw.- Throws:
java.io.IOException- If an io exception occurs.
-
setStrokingColorSpace
public void setStrokingColorSpace(PDColorSpace colorSpace) throws java.io.IOException
Set the stroking color space. This will add the colorspace to the PDResources if necessary.- Parameters:
colorSpace- The colorspace to write.- Throws:
java.io.IOException- If there is an error writing the colorspace.
-
setNonStrokingColorSpace
public void setNonStrokingColorSpace(PDColorSpace colorSpace) throws java.io.IOException
Set the stroking color space. This will add the colorspace to the PDResources if necessary.- Parameters:
colorSpace- The colorspace to write.- Throws:
java.io.IOException- If there is an error writing the colorspace.
-
setStrokingColor
public void setStrokingColor(float[] components) throws java.io.IOExceptionSet the color components of current stroking colorspace.- Parameters:
components- The components to set for the current color.- Throws:
java.io.IOException- If there is an error while writing to the stream.
-
setStrokingColor
public void setStrokingColor(java.awt.Color color) throws java.io.IOExceptionSet the stroking color, specified as RGB.- Parameters:
color- The color to set.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.
-
setNonStrokingColor
public void setNonStrokingColor(java.awt.Color color) throws java.io.IOExceptionSet the non stroking color, specified as RGB.- Parameters:
color- The color to set.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.
-
setStrokingColor
public void setStrokingColor(int r, int g, int b) throws java.io.IOExceptionSet the stroking color, specified as RGB, 0-255.- Parameters:
r- The red value.g- The green value.b- The blue value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the parameters are invalid.
-
setStrokingColor
public void setStrokingColor(int c, int m, int y, int k) throws java.io.IOExceptionSet the stroking color, specified as CMYK, 0-255.- Parameters:
c- The cyan value.m- The magenta value.y- The yellow value.k- The black value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the parameters are invalid.
-
setStrokingColor
public void setStrokingColor(double c, double m, double y, double k) throws java.io.IOExceptionSet the stroking color, specified as CMYK, 0.0-1.0.- Parameters:
c- The cyan value.m- The magenta value.y- The yellow value.k- The black value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the parameters are invalid.
-
setStrokingColor
public void setStrokingColor(int g) throws java.io.IOExceptionSet the stroking color, specified as grayscale, 0-255.- Parameters:
g- The gray value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the parameter is invalid.
-
setStrokingColor
public void setStrokingColor(double g) throws java.io.IOExceptionSet the stroking color, specified as Grayscale 0.0-1.0.- Parameters:
g- The gray value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the parameter is invalid.
-
setNonStrokingColor
public void setNonStrokingColor(float[] components) throws java.io.IOExceptionSet the color components of current non stroking colorspace.- Parameters:
components- The components to set for the current color.- Throws:
java.io.IOException- If there is an error while writing to the stream.
-
setNonStrokingColor
public void setNonStrokingColor(int r, int g, int b) throws java.io.IOExceptionSet the non stroking color, specified as RGB, 0-255.- Parameters:
r- The red value.g- The green value.b- The blue value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the parameters are invalid.
-
setNonStrokingColor
public void setNonStrokingColor(int c, int m, int y, int k) throws java.io.IOExceptionSet the non stroking color, specified as CMYK, 0-255.- Parameters:
c- The cyan value.m- The magenta value.y- The yellow value.k- The black value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the current colorspace is not DeviceCMYK, or if the parameters are invalid.
-
setNonStrokingColor
public void setNonStrokingColor(double c, double m, double y, double k) throws java.io.IOExceptionSet the non stroking color, specified as CMYK, 0.0-1.0.- Parameters:
c- The cyan value.m- The magenta value.y- The yellow value.k- The black value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the current colorspace is not DeviceCMYK, or if the parameters are invalid.
-
setNonStrokingColor
public void setNonStrokingColor(int g) throws java.io.IOExceptionSet the non stroking color, specified as grayscale, 0-255.- Parameters:
g- The gray value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the current colorspace is not DeviceGray, or if the parameter is invalid.
-
setNonStrokingColor
public void setNonStrokingColor(double g) throws java.io.IOExceptionSet the non stroking color, specified as Grayscale 0.0-1.0.- Parameters:
g- The gray value.- Throws:
java.io.IOException- If an IO error occurs while writing to the stream.java.lang.IllegalArgumentException- If the current colorspace is not DeviceGray, or if the parameter is invalid.
-
addRect
public void addRect(float x, float y, float width, float height) throws java.io.IOExceptionAdd a rectangle to the current path.- Parameters:
x- The lower left x coordinate.y- The lower left y coordinate.width- The width of the rectangle.height- The height of the rectangle.- Throws:
java.io.IOException- If there is an error while drawing on the screen.
-
fillRect
public void fillRect(float x, float y, float width, float height) throws java.io.IOExceptionFill a rectangle on the page using the current non stroking color.- Parameters:
x- The lower left x coordinate.y- The lower left y coordinate.width- The width of the rectangle.height- The height of the rectangle.- Throws:
java.io.IOException- If there is an error while drawing on the screen.
-
addBezier312
public void addBezier312(float x1, float y1, float x2, float y2, float x3, float y3) throws java.io.IOExceptionAppend a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3 , y3 ), using (x1 , y1 ) and (x2 , y2 ) as the Bézier control points- Parameters:
x1- x coordinate of the point 1y1- y coordinate of the point 1x2- x coordinate of the point 2y2- y coordinate of the point 2x3- x coordinate of the point 3y3- y coordinate of the point 3- Throws:
java.io.IOException- If there is an error while adding the .
-
addBezier32
public void addBezier32(float x2, float y2, float x3, float y3) throws java.io.IOExceptionAppend a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3 , y3 ), using the current point and (x2 , y2 ) as the Bézier control points- Parameters:
x2- x coordinate of the point 2y2- y coordinate of the point 2x3- x coordinate of the point 3y3- y coordinate of the point 3- Throws:
java.io.IOException- If there is an error while adding the .
-
addBezier31
public void addBezier31(float x1, float y1, float x3, float y3) throws java.io.IOExceptionAppend a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3 , y3 ), using (x1 , y1 ) and (x3 , y3 ) as the Bézier control points- Parameters:
x1- x coordinate of the point 1y1- y coordinate of the point 1x3- x coordinate of the point 3y3- y coordinate of the point 3- Throws:
java.io.IOException- If there is an error while adding the .
-
moveTo
public void moveTo(float x, float y) throws java.io.IOExceptionAdd a line to the given coordinate.- Parameters:
x- The x coordinate.y- The y coordinate.- Throws:
java.io.IOException- If there is an error while adding the line.
-
lineTo
public void lineTo(float x, float y) throws java.io.IOExceptionAdd a move to the given coordinate.- Parameters:
x- The x coordinate.y- The y coordinate.- Throws:
java.io.IOException- If there is an error while adding the line.
-
addLine
public void addLine(float xStart, float yStart, float xEnd, float yEnd) throws java.io.IOExceptionadd a line to the current path.- Parameters:
xStart- The start x coordinate.yStart- The start y coordinate.xEnd- The end x coordinate.yEnd- The end y coordinate.- Throws:
java.io.IOException- If there is an error while adding the line.
-
drawLine
public void drawLine(float xStart, float yStart, float xEnd, float yEnd) throws java.io.IOExceptionDraw a line on the page using the current stroking color and the current line width.- Parameters:
xStart- The start x coordinate.yStart- The start y coordinate.xEnd- The end x coordinate.yEnd- The end y coordinate.- Throws:
java.io.IOException- If there is an error while drawing on the screen.
-
addPolygon
public void addPolygon(float[] x, float[] y) throws java.io.IOExceptionAdd a polygon to the current path.- Parameters:
x- x coordinate of each pointsy- y coordinate of each points- Throws:
java.io.IOException- If there is an error while drawing on the screen.
-
drawPolygon
public void drawPolygon(float[] x, float[] y) throws java.io.IOExceptionDraw a polygon on the page using the current stroking color.- Parameters:
x- x coordinate of each pointsy- y coordinate of each points- Throws:
java.io.IOException- If there is an error while drawing on the screen.
-
fillPolygon
public void fillPolygon(float[] x, float[] y) throws java.io.IOExceptionDraw and fill a polygon on the page using the current stroking / non stroking colors.- Parameters:
x- x coordinate of each pointsy- y coordinate of each points- Throws:
java.io.IOException- If there is an error while drawing on the screen.
-
stroke
public void stroke() throws java.io.IOExceptionStroke the path.- Throws:
java.io.IOException- If there is an error while stroking the path.
-
closeAndStroke
public void closeAndStroke() throws java.io.IOExceptionClose and stroke the path.- Throws:
java.io.IOException- If there is an error while closing and stroking the path.
-
fill
public void fill(int windingRule) throws java.io.IOExceptionFill the path.- Parameters:
windingRule- the winding rule to be used for filling- Throws:
java.io.IOException- If there is an error while filling the path.
-
closeSubPath
public void closeSubPath() throws java.io.IOExceptionClose subpath.- Throws:
java.io.IOException- If there is an error while closing the subpath.
-
clipPath
public void clipPath(int windingRule) throws java.io.IOExceptionClip path.- Parameters:
windingRule- the winding rule to be used for clipping- Throws:
java.io.IOException- If there is an error while clipping the path.
-
setLineWidth
public void setLineWidth(float lineWidth) throws java.io.IOExceptionSet linewidth to the given value.- Parameters:
lineWidth- The width which is used for drawing.- Throws:
java.io.IOException- If there is an error while drawing on the screen.
-
setLineJoinStyle
public void setLineJoinStyle(int lineJoinStyle) throws java.io.IOExceptionSet the line join style.- Parameters:
lineJoinStyle- 0 for miter join, 1 for round join, and 2 for bevel join.- Throws:
java.io.IOException- If there is an error while writing to the stream.
-
setLineCapStyle
public void setLineCapStyle(int lineCapStyle) throws java.io.IOExceptionSet the line cap style.- Parameters:
lineCapStyle- 0 for butt cap, 1 for round cap, and 2 for projecting square cap.- Throws:
java.io.IOException- If there is an error while writing to the stream.
-
setLineDashPattern
public void setLineDashPattern(float[] pattern, float phase) throws java.io.IOExceptionSet the line dash pattern.- Parameters:
pattern- The pattern arrayphase- The phase of the pattern- Throws:
java.io.IOException- If there is an error while writing to the stream.
-
beginMarkedContentSequence
public void beginMarkedContentSequence(COSName tag) throws java.io.IOException
Begin a marked content sequence.- Parameters:
tag- the tag- Throws:
java.io.IOException- if an I/O error occurs
-
beginMarkedContentSequence
public void beginMarkedContentSequence(COSName tag, COSName propsName) throws java.io.IOException
Begin a marked content sequence with a reference to an entry in the page resources' Properties dictionary.- Parameters:
tag- the tagpropsName- the properties reference- Throws:
java.io.IOException- if an I/O error occurs
-
endMarkedContentSequence
public void endMarkedContentSequence() throws java.io.IOExceptionEnd a marked content sequence.- Throws:
java.io.IOException- if an I/O error occurs
-
saveGraphicsState
public void saveGraphicsState() throws java.io.IOExceptionq operator. Saves the current graphics state.- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
restoreGraphicsState
public void restoreGraphicsState() throws java.io.IOExceptionQ operator. Restores the current graphics state.- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
appendRawCommands
public void appendRawCommands(java.lang.String commands) throws java.io.IOExceptionThis will append raw commands to the content stream.- Parameters:
commands- The commands to append to the stream.- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
appendRawCommands
public void appendRawCommands(byte[] commands) throws java.io.IOExceptionThis will append raw commands to the content stream.- Parameters:
commands- The commands to append to the stream.- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
appendRawCommands
public void appendRawCommands(int data) throws java.io.IOExceptionThis will append raw commands to the content stream.- Parameters:
data- Append a raw byte to the stream.- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
appendRawCommands
public void appendRawCommands(double data) throws java.io.IOExceptionThis will append raw commands to the content stream.- Parameters:
data- Append a formatted double value to the stream.- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
appendRawCommands
public void appendRawCommands(float data) throws java.io.IOExceptionThis will append raw commands to the content stream.- Parameters:
data- Append a formatted float value to the stream.- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
appendCOSName
public void appendCOSName(COSName name) throws java.io.IOException
This will append aCOSNameto the content stream.- Parameters:
name- the name- Throws:
java.io.IOException- If an error occurs while writing to the stream.
-
close
public void close() throws java.io.IOExceptionClose the content stream. This must be called when you are done with this object.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException- If the underlying stream has a problem being written to.
-
-