public final class PDPageContentStream extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static class |
PDPageContentStream.AppendMode
This is to choose what to do with the stream: overwrite, append or prepend.
|
Constructor and Description |
---|
PDPageContentStream(PDDocument doc,
PDAppearanceStream appearance)
Create a new appearance stream.
|
PDPageContentStream(PDDocument doc,
PDAppearanceStream appearance,
OutputStream outputStream)
Create a new appearance stream.
|
PDPageContentStream(PDDocument document,
PDPage sourcePage)
Create a new PDPage content stream.
|
PDPageContentStream(PDDocument document,
PDPage sourcePage,
boolean appendContent,
boolean compress)
|
PDPageContentStream(PDDocument document,
PDPage sourcePage,
boolean appendContent,
boolean compress,
boolean resetContext)
|
PDPageContentStream(PDDocument document,
PDPage sourcePage,
PDPageContentStream.AppendMode appendContent,
boolean compress)
Create a new PDPage content stream.
|
PDPageContentStream(PDDocument document,
PDPage sourcePage,
PDPageContentStream.AppendMode appendContent,
boolean compress,
boolean resetContext)
Create a new PDPage content stream.
|
Modifier and Type | Method and Description |
---|---|
void |
addBezier31(float x1,
float y1,
float x3,
float y3)
Deprecated.
Use
curveTo1(float, float, float, float) instead. |
void |
addBezier312(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Deprecated.
Use
curveTo(float, float, float, float, float, float) instead. |
void |
addBezier32(float x2,
float y2,
float x3,
float y3)
Deprecated.
Use
curveTo2(float, float, float, float) instead. |
void |
addComment(String comment)
Write a comment line.
|
void |
addLine(float xStart,
float yStart,
float xEnd,
float yEnd)
Deprecated.
Use
moveto(xStart,yStart) followed by
lineTo(xEnd,yEnd) . |
void |
addPolygon(float[] x,
float[] y)
Deprecated.
Use
moveTo(float, float) and lineTo(float, float) methods instead. |
void |
addRect(float x,
float y,
float width,
float height)
Add a rectangle to the current path.
|
void |
appendCOSName(COSName name)
Deprecated.
This method will be removed in a future release.
|
void |
appendRawCommands(byte[] commands)
Deprecated.
This method will be removed in a future release.
|
void |
appendRawCommands(double data)
Deprecated.
This method will be removed in a future release.
|
void |
appendRawCommands(float data)
Deprecated.
This method will be removed in a future release.
|
void |
appendRawCommands(int data)
Deprecated.
This method will be removed in a future release.
|
void |
appendRawCommands(String commands)
Deprecated.
This method will be removed in a future release.
|
void |
beginMarkedContent(COSName tag)
Begin a marked content sequence.
|
void |
beginMarkedContent(COSName tag,
PDPropertyList propertyList)
Begin a marked content sequence with a reference to an entry in the page resources'
Properties dictionary.
|
void |
beginMarkedContentSequence(COSName tag)
Deprecated.
Use
beginMarkedContent(org.apache.pdfbox.cos.COSName) instead. |
void |
beginMarkedContentSequence(COSName tag,
COSName propsName)
Deprecated.
Use
beginMarkedContent(COSName, PDPropertyList) instead. |
void |
beginText()
Begin some text operations.
|
void |
clip()
Intersects the current clipping path with the current path, using the nonzero rule.
|
void |
clipEvenOdd()
Intersects the current clipping path with the current path, using the even-odd rule.
|
void |
clipPath(int windingRule)
Deprecated.
Use
clip() or clipEvenOdd() instead. |
void |
close()
Close the content stream.
|
void |
closeAndFillAndStroke()
Close, fill, and then stroke the path, using the nonzero winding number rule to determine the
region to fill.
|
void |
closeAndFillAndStrokeEvenOdd()
Close, fill, and then stroke the path, using the even-odd rule to determine the region to
fill.
|
void |
closeAndStroke()
Close and stroke the path.
|
void |
closePath()
Closes the current subpath.
|
void |
closeSubPath()
Deprecated.
Use
closePath() instead. |
void |
concatenate2CTM(AffineTransform at)
Deprecated.
Use
transform(org.apache.pdfbox.util.Matrix) instead. |
void |
concatenate2CTM(double a,
double b,
double c,
double d,
double e,
double f)
Deprecated.
Use
transform(org.apache.pdfbox.util.Matrix) instead. |
void |
curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Append a cubic Bézier curve to the current path.
|
void |
curveTo1(float x1,
float y1,
float x3,
float y3)
Append a cubic Bézier curve to the current path.
|
void |
curveTo2(float x2,
float y2,
float x3,
float y3)
Append a cubic Bézier curve to the current path.
|
void |
drawForm(PDFormXObject form)
Draws the given Form XObject at the current location.
|
void |
drawImage(PDImageXObject image,
float x,
float y)
Draw an image at the x,y coordinates, with the default size of the image.
|
void |
drawImage(PDImageXObject image,
float x,
float y,
float width,
float height)
Draw an image at the x,y coordinates, with the given size.
|
void |
drawImage(PDImageXObject image,
Matrix matrix)
Draw an image at the origin with the given transformation matrix.
|
void |
drawImage(PDInlineImage inlineImage,
float x,
float y)
Draw an inline image at the x,y coordinates, with the default size of the image.
|
void |
drawImage(PDInlineImage inlineImage,
float x,
float y,
float width,
float height)
Draw an inline image at the x,y coordinates and a certain width and height.
|
void |
drawInlineImage(PDInlineImage inlineImage,
float x,
float y)
Deprecated.
Use
drawImage(PDInlineImage, float, float) instead. |
void |
drawInlineImage(PDInlineImage inlineImage,
float x,
float y,
float width,
float height)
Deprecated.
Use
drawImage(PDInlineImage, float, float, float, float) instead. |
void |
drawLine(float xStart,
float yStart,
float xEnd,
float yEnd)
Deprecated.
|
void |
drawPolygon(float[] x,
float[] y)
Deprecated.
Use
moveTo(float, float) and lineTo(float, float) methods instead. |
void |
drawString(String text)
Deprecated.
Use
showText(java.lang.String) instead. |
void |
drawXObject(PDXObject xobject,
AffineTransform transform)
Deprecated.
|
void |
drawXObject(PDXObject xobject,
float x,
float y,
float width,
float height)
Deprecated.
|
void |
endMarkedContent()
End a marked content sequence.
|
void |
endMarkedContentSequence()
Deprecated.
Use
endMarkedContent() instead. |
void |
endText()
End some text operations.
|
void |
fill()
Fills the path using the nonzero winding number rule.
|
void |
fill(int windingRule)
Deprecated.
Use
fill() or fillEvenOdd() instead. |
void |
fillAndStroke()
Fill and then stroke the path, using the nonzero winding number rule to determine the region
to fill.
|
void |
fillAndStrokeEvenOdd()
Fill and then stroke the path, using the even-odd rule to determine the region to
fill.
|
void |
fillEvenOdd()
Fills the path using the even-odd winding rule.
|
void |
fillPolygon(float[] x,
float[] y)
Deprecated.
Use
moveTo(float, float) and lineTo(float, float) methods instead. |
void |
fillRect(float x,
float y,
float width,
float height)
Deprecated.
Use
addRect(float, float, float, float) followed by fill() instead. |
void |
lineTo(float x,
float y)
Draw a line from the current position to the given coordinates.
|
void |
moveTextPositionByAmount(float tx,
float ty)
Deprecated.
Use
newLineAtOffset(float, float) instead. |
void |
moveTo(float x,
float y)
Move the current position to the given coordinates.
|
void |
newLine()
Move to the start of the next line of text.
|
void |
newLineAtOffset(float tx,
float ty)
The Td operator.
|
void |
restoreGraphicsState()
Q operator.
|
void |
saveGraphicsState()
q operator.
|
void |
setCharacterSpacing(float spacing)
Set the character spacing.
|
void |
setFont(PDFont font,
float fontSize)
Set the font and font size to draw text with.
|
void |
setGraphicsStateParameters(PDExtendedGraphicsState state)
Set an extended graphics state.
|
void |
setLeading(double leading)
Sets the text leading.
|
void |
setLineCapStyle(int lineCapStyle)
Set the line cap style.
|
void |
setLineDashPattern(float[] pattern,
float phase)
Set the line dash pattern.
|
void |
setLineJoinStyle(int lineJoinStyle)
Set the line join style.
|
void |
setLineWidth(float lineWidth)
Set line width to the given value.
|
void |
setMiterLimit(float miterLimit)
Set the miter limit.
|
void |
setNonStrokingColor(Color color)
Set the non-stroking color using an AWT color.
|
void |
setNonStrokingColor(double g)
Set the non-stroking color in the DeviceGray color space.
|
void |
setNonStrokingColor(double c,
double m,
double y,
double k)
Set the non-stroking color in the DeviceRGB color space.
|
void |
setNonStrokingColor(float[] components)
Deprecated.
Use
setNonStrokingColor(PDColor) instead. |
void |
setNonStrokingColor(int g)
Set the non-stroking color in the DeviceGray color space.
|
void |
setNonStrokingColor(int r,
int g,
int b)
Set the non-stroking color in the DeviceRGB color space.
|
void |
setNonStrokingColor(int c,
int m,
int y,
int k)
Set the non-stroking color in the DeviceCMYK color space.
|
void |
setNonStrokingColor(PDColor color)
Sets the non-stroking color and, if necessary, the non-stroking color space.
|
void |
setNonStrokingColorSpace(PDColorSpace colorSpace)
Deprecated.
|
void |
setRenderingMode(RenderingMode rm)
Set the text rendering mode.
|
void |
setStrokingColor(Color color)
Set the stroking color using an AWT color.
|
void |
setStrokingColor(double g)
Set the stroking color in the DeviceGray color space.
|
void |
setStrokingColor(float[] components)
Deprecated.
Use
setStrokingColor(PDColor) instead. |
void |
setStrokingColor(float c,
float m,
float y,
float k)
Set the stroking color in the DeviceCMYK color space.
|
void |
setStrokingColor(int g)
Deprecated.
Use
setStrokingColor(double) instead. |
void |
setStrokingColor(int r,
int g,
int b)
Set the stroking color in the DeviceRGB color space.
|
void |
setStrokingColor(int c,
int m,
int y,
int k)
Deprecated.
Use
setStrokingColor(float, float, float, float) instead. |
void |
setStrokingColor(PDColor color)
Sets the stroking color and, if necessary, the stroking color space.
|
void |
setStrokingColorSpace(PDColorSpace colorSpace)
Deprecated.
|
void |
setTextMatrix(AffineTransform matrix)
Deprecated.
Use
setTextMatrix(Matrix) instead. |
void |
setTextMatrix(double a,
double b,
double c,
double d,
double e,
double f)
Deprecated.
Use
setTextMatrix(Matrix) instead. |
void |
setTextMatrix(Matrix matrix)
The Tm operator.
|
void |
setTextRotation(double angle,
double tx,
double ty)
Deprecated.
Use
setTextMatrix(Matrix) instead. |
void |
setTextScaling(double sx,
double sy,
double tx,
double ty)
Deprecated.
Use
setTextMatrix(Matrix) instead. |
void |
setTextTranslation(double tx,
double ty)
Deprecated.
Use
setTextMatrix(Matrix) instead. |
void |
setWordSpacing(float spacing)
Set the word spacing.
|
void |
shadingFill(PDShading shading)
Fills the clipping area with the given shading.
|
void |
showText(String text)
Shows the given text at the location specified by the current text matrix.
|
void |
stroke()
Stroke the path.
|
void |
transform(Matrix matrix)
The cm operator.
|
protected void |
writeOperand(float real)
Writes a real number to the content stream.
|
public PDPageContentStream(PDDocument document, PDPage sourcePage) throws IOException
document
- The document the page is part of.sourcePage
- The page to write the contents to.IOException
- If there is an error writing to the page contents.@Deprecated public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, boolean compress) throws IOException
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.IOException
- If there is an error writing to the page contents.public PDPageContentStream(PDDocument document, PDPage sourcePage, PDPageContentStream.AppendMode appendContent, boolean compress) throws IOException
document
- The document the page is part of.sourcePage
- The page to write the contents to.appendContent
- Indicates whether content will be overwritten, appended or prepended.compress
- Tell if the content stream should compress the page contents.IOException
- If there is an error writing to the page contents.@Deprecated public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, boolean compress, boolean resetContext) throws IOException
PDPageContentStream(PDDocument, PDPage, PDPageContentStream.AppendMode, boolean, boolean)
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. You should use this when
appending to an existing stream, because the existing stream may have changed graphic
properties (e.g. scaling, rotation).IOException
- If there is an error writing to the page contents.public PDPageContentStream(PDDocument document, PDPage sourcePage, PDPageContentStream.AppendMode appendContent, boolean compress, boolean resetContext) throws IOException
document
- The document the page is part of.sourcePage
- The page to write the contents to.appendContent
- Indicates whether content will be overwritten, appended or prepended.compress
- Tell if the content stream should compress the page contents.resetContext
- Tell if the graphic context should be reset. This is only relevant when
the appendContent parameter is set to PDPageContentStream.AppendMode.APPEND
. You should use this when
appending to an existing stream, because the existing stream may have changed graphic
properties (e.g. scaling, rotation).IOException
- If there is an error writing to the page contents.public PDPageContentStream(PDDocument doc, PDAppearanceStream appearance) throws IOException
doc
- The document the page is part of.appearance
- The appearance stream to write to.IOException
- If there is an error writing to the page contents.public PDPageContentStream(PDDocument doc, PDAppearanceStream appearance, OutputStream outputStream) throws IOException
doc
- The document the appearance is part of.appearance
- The appearance stream to add to.outputStream
- The appearances output stream to write to.IOException
- If there is an error writing to the page contents.public void beginText() throws IOException
IOException
- If there is an error writing to the stream or if you attempt to
nest beginText calls.IllegalStateException
- If the method was not allowed to be called at this time.public void endText() throws IOException
IOException
- If there is an error writing to the stream or if you attempt to
nest endText calls.IllegalStateException
- If the method was not allowed to be called at this time.public void setFont(PDFont font, float fontSize) throws IOException
font
- The font to use.fontSize
- The font size to draw the text.IOException
- If there is an error writing the font information.@Deprecated public void drawString(String text) throws IOException
showText(java.lang.String)
instead.text
- The text to draw.IOException
- If an io exception occurs.public void showText(String text) throws IOException
text
- The Unicode text to show.IOException
- If an io exception occurs.public void setLeading(double leading) throws IOException
leading
- The leading in unscaled text units.IOException
- If there is an error writing to the stream.public void newLine() throws IOException
setLeading(double)
)
to have been set.IOException
- If there is an error writing to the stream.@Deprecated public void moveTextPositionByAmount(float tx, float ty) throws IOException
newLineAtOffset(float, float)
instead.tx
- The x translation.ty
- The y translation.IOException
- If there is an error writing to the stream.public void newLineAtOffset(float tx, float ty) throws IOException
tx
- The x translation.ty
- The y translation.IOException
- If there is an error writing to the stream.IllegalStateException
- If the method was not allowed to be called at this time.@Deprecated public void setTextMatrix(double a, double b, double c, double d, double e, double f) throws IOException
setTextMatrix(Matrix)
instead.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.IOException
- If there is an error writing to the stream.@Deprecated public void setTextMatrix(AffineTransform matrix) throws IOException
setTextMatrix(Matrix)
instead.matrix
- the transformation matrixIOException
- If there is an error writing to the stream.public void setTextMatrix(Matrix matrix) throws IOException
matrix
- the transformation matrixIOException
- If there is an error writing to the stream.IllegalStateException
- If the method was not allowed to be called at this time.@Deprecated public void setTextScaling(double sx, double sy, double tx, double ty) throws IOException
setTextMatrix(Matrix)
instead.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.IOException
- If there is an error writing to the stream.@Deprecated public void setTextTranslation(double tx, double ty) throws IOException
setTextMatrix(Matrix)
instead.tx
- The translation value in x-direction.ty
- The translation value in y-direction.IOException
- If there is an error writing to the stream.@Deprecated public void setTextRotation(double angle, double tx, double ty) throws IOException
setTextMatrix(Matrix)
instead.angle
- The angle used for the counterclockwise rotation in radians.tx
- The translation value in x-direction.ty
- The translation value in y-direction.IOException
- If there is an error writing to the stream.public void drawImage(PDImageXObject image, float x, float y) throws IOException
image
- The image to draw.x
- The x-coordinate to draw the image.y
- The y-coordinate to draw the image.IOException
- If there is an error writing to the stream.public void drawImage(PDImageXObject image, float x, float y, float width, float height) throws IOException
image
- The image to draw.x
- The x-coordinate to draw the image.y
- The y-coordinate to draw the image.width
- The width to draw the image.height
- The height to draw the image.IOException
- If there is an error writing to the stream.IllegalStateException
- If the method was called within a text block.public void drawImage(PDImageXObject image, Matrix matrix) throws IOException
image
- The image to draw.matrix
- The transformation matrix to apply to the image.IOException
- If there is an error writing to the stream.IllegalStateException
- If the method was called within a text block.@Deprecated public void drawInlineImage(PDInlineImage inlineImage, float x, float y) throws IOException
drawImage(PDInlineImage, float, float)
instead.inlineImage
- The inline image to draw.x
- The x-coordinate to draw the inline image.y
- The y-coordinate to draw the inline image.IOException
- If there is an error writing to the stream.public void drawImage(PDInlineImage inlineImage, float x, float y) throws IOException
inlineImage
- The inline image to draw.x
- The x-coordinate to draw the inline image.y
- The y-coordinate to draw the inline image.IOException
- If there is an error writing to the stream.@Deprecated public void drawInlineImage(PDInlineImage inlineImage, float x, float y, float width, float height) throws IOException
drawImage(PDInlineImage, float, float, float, float)
instead.inlineImage
- The inline image to draw.x
- The x-coordinate to draw the inline image.y
- The y-coordinate to draw the inline image.width
- The width of the inline image to draw.height
- The height of the inline image to draw.IOException
- If there is an error writing to the stream.public void drawImage(PDInlineImage inlineImage, float x, float y, float width, float height) throws IOException
inlineImage
- The inline image to draw.x
- The x-coordinate to draw the inline image.y
- The y-coordinate to draw the inline image.width
- The width of the inline image to draw.height
- The height of the inline image to draw.IOException
- If there is an error writing to the stream.IllegalStateException
- If the method was called within a text block.@Deprecated public void drawXObject(PDXObject xobject, float x, float y, float width, float height) throws IOException
drawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject, float, float)
instead.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.IOException
- If there is an error writing to the stream.@Deprecated public void drawXObject(PDXObject xobject, AffineTransform transform) throws IOException
drawImage(PDImageXObject, Matrix)
or drawForm(PDFormXObject)
with
transform(Matrix)
instead.AffineTransform
to position
the xobject.xobject
- The xobject to draw.transform
- the transformation matrixIOException
- If there is an error writing to the stream.IllegalStateException
- If the method was called within a text block.public void drawForm(PDFormXObject form) throws IOException
form
- Form XObjectIOException
- if the content stream could not be writtenIllegalStateException
- If the method was called within a text block.@Deprecated public void concatenate2CTM(double a, double b, double c, double d, double e, double f) throws IOException
transform(org.apache.pdfbox.util.Matrix)
instead.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.IOException
- If there is an error writing to the stream.@Deprecated public void concatenate2CTM(AffineTransform at) throws IOException
transform(org.apache.pdfbox.util.Matrix)
instead.AffineTransform
.at
- the transformation matrixIOException
- If there is an error writing to the stream.public void transform(Matrix matrix) throws IOException
matrix
- the transformation matrixIOException
- If there is an error writing to the stream.public void saveGraphicsState() throws IOException
IOException
- If an error occurs while writing to the stream.public void restoreGraphicsState() throws IOException
IOException
- If an error occurs while writing to the stream.@Deprecated public void setStrokingColorSpace(PDColorSpace colorSpace) throws IOException
setStrokingColor(org.apache.pdfbox.pdmodel.graphics.color.PDColor)
instead.colorSpace
- The colorspace to write.IOException
- If there is an error writing the colorspace.@Deprecated public void setNonStrokingColorSpace(PDColorSpace colorSpace) throws IOException
setNonStrokingColor(org.apache.pdfbox.pdmodel.graphics.color.PDColor)
instead.colorSpace
- The colorspace to write.IOException
- If there is an error writing the colorspace.public void setStrokingColor(PDColor color) throws IOException
color
- Color in a specific color space.IOException
- If an IO error occurs while writing to the stream.public void setStrokingColor(Color color) throws IOException
color
- The color to set.IOException
- If an IO error occurs while writing to the stream.@Deprecated public void setStrokingColor(float[] components) throws IOException
setStrokingColor(PDColor)
instead.components
- The components to set for the current color.IOException
- If there is an error while writing to the stream.public void setStrokingColor(int r, int g, int b) throws IOException
r
- The red valueg
- The green value.b
- The blue value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameters are invalid.@Deprecated public void setStrokingColor(int c, int m, int y, int k) throws IOException
setStrokingColor(float, float, float, float)
instead.c
- The cyan value.m
- The magenta value.y
- The yellow value.k
- The black value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameters are invalid.public void setStrokingColor(float c, float m, float y, float k) throws IOException
c
- The cyan value.m
- The magenta value.y
- The yellow value.k
- The black value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameters are invalid.@Deprecated public void setStrokingColor(int g) throws IOException
setStrokingColor(double)
instead.g
- The gray value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameter is invalid.public void setStrokingColor(double g) throws IOException
g
- The gray value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameter is invalid.public void setNonStrokingColor(PDColor color) throws IOException
color
- Color in a specific color space.IOException
- If an IO error occurs while writing to the stream.public void setNonStrokingColor(Color color) throws IOException
color
- The color to set.IOException
- If an IO error occurs while writing to the stream.@Deprecated public void setNonStrokingColor(float[] components) throws IOException
setNonStrokingColor(PDColor)
instead.components
- The components to set for the current color.IOException
- If there is an error while writing to the stream.public void setNonStrokingColor(int r, int g, int b) throws IOException
r
- The red value.g
- The green value.b
- The blue value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameters are invalid.public void setNonStrokingColor(int c, int m, int y, int k) throws IOException
c
- The cyan value.m
- The magenta value.y
- The yellow value.k
- The black value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameters are invalid.public void setNonStrokingColor(double c, double m, double y, double k) throws IOException
c
- The cyan value.m
- The magenta value.y
- The yellow value.k
- The black value.IOException
- If an IO error occurs while writing to the stream.public void setNonStrokingColor(int g) throws IOException
g
- The gray value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameter is invalid.public void setNonStrokingColor(double g) throws IOException
g
- The gray value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameter is invalid.public void addRect(float x, float y, float width, float height) throws IOException
x
- The lower left x coordinate.y
- The lower left y coordinate.width
- The width of the rectangle.height
- The height of the rectangle.IOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.@Deprecated public void fillRect(float x, float y, float width, float height) throws IOException
x
- The lower left x coordinate.y
- The lower left y coordinate.width
- The width of the rectangle.height
- The height of the rectangle.IOException
- If there is an error while drawing on the screen.IllegalStateException
- If the method was called within a text block.@Deprecated public void addBezier312(float x1, float y1, float x2, float y2, float x3, float y3) throws IOException
curveTo(float, float, float, float, float, float)
instead.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 3IOException
- If there is an error while adding the .public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) throws IOException
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 3IOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.@Deprecated public void addBezier32(float x2, float y2, float x3, float y3) throws IOException
curveTo2(float, float, float, float)
instead.x2
- x coordinate of the point 2y2
- y coordinate of the point 2x3
- x coordinate of the point 3y3
- y coordinate of the point 3IOException
- If there is an error while adding the .public void curveTo2(float x2, float y2, float x3, float y3) throws IOException
x2
- x coordinate of the point 2y2
- y coordinate of the point 2x3
- x coordinate of the point 3y3
- y coordinate of the point 3IllegalStateException
- If the method was called within a text block.IOException
- If the content stream could not be written.@Deprecated public void addBezier31(float x1, float y1, float x3, float y3) throws IOException
curveTo1(float, float, float, float)
instead.x1
- x coordinate of the point 1y1
- y coordinate of the point 1x3
- x coordinate of the point 3y3
- y coordinate of the point 3IOException
- If there is an error while adding the .public void curveTo1(float x1, float y1, float x3, float y3) throws IOException
x1
- x coordinate of the point 1y1
- y coordinate of the point 1x3
- x coordinate of the point 3y3
- y coordinate of the point 3IOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.public void moveTo(float x, float y) throws IOException
x
- The x coordinate.y
- The y coordinate.IOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.public void lineTo(float x, float y) throws IOException
x
- The x coordinate.y
- The y coordinate.IOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.@Deprecated public void addLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException
xStart
- The start x coordinate.yStart
- The start y coordinate.xEnd
- The end x coordinate.yEnd
- The end y coordinate.IOException
- If there is an error while adding the line.IllegalStateException
- If the method was called within a text block.@Deprecated public void drawLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException
xStart
- The start x coordinate.yStart
- The start y coordinate.xEnd
- The end x coordinate.yEnd
- The end y coordinate.IOException
- If there is an error while drawing on the screen.IllegalStateException
- If the method was called within a text block.@Deprecated public void addPolygon(float[] x, float[] y) throws IOException
x
- x coordinate of each pointsy
- y coordinate of each pointsIOException
- If there is an error while drawing on the screen.IllegalStateException
- If the method was called within a text block.IllegalArgumentException
- If the two arrays have different lengths.@Deprecated public void drawPolygon(float[] x, float[] y) throws IOException
x
- x coordinate of each pointsy
- y coordinate of each pointsIOException
- If there is an error while drawing on the screen.IllegalStateException
- If the method was called within a text block.@Deprecated public void fillPolygon(float[] x, float[] y) throws IOException
x
- x coordinate of each pointsy
- y coordinate of each pointsIOException
- If there is an error while drawing on the screen.IllegalStateException
- If the method was called within a text block.public void stroke() throws IOException
IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void closeAndStroke() throws IOException
IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.@Deprecated public void fill(int windingRule) throws IOException
windingRule
- the winding rule to be used for fillingIOException
- If the content stream could not be writtenIllegalArgumentException
- If the parameter is not a valid winding rule.public void fill() throws IOException
IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void fillEvenOdd() throws IOException
IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void fillAndStroke() throws IOException
fill()
and the second with stroke()
.IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void fillAndStrokeEvenOdd() throws IOException
fillEvenOdd()
and the second with stroke()
.IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void closeAndFillAndStroke() throws IOException
closePath()
and then fillAndStroke()
.IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void closeAndFillAndStrokeEvenOdd() throws IOException
closePath()
and then fillAndStrokeEvenOdd()
.IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void shadingFill(PDShading shading) throws IOException
shading
- Shading resourceIOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.@Deprecated public void closeSubPath() throws IOException
closePath()
instead.IOException
- If the content stream could not be writtenpublic void closePath() throws IOException
IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.@Deprecated public void clipPath(int windingRule) throws IOException
windingRule
- the winding rule to be used for clippingIOException
- If there is an error while clipping the path.IllegalStateException
- If the method was called within a text block.public void clip() throws IOException
IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void clipEvenOdd() throws IOException
IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void setLineWidth(float lineWidth) throws IOException
lineWidth
- The width which is used for drwaing.IOException
- If the content stream could not be writtenIllegalStateException
- If the method was called within a text block.public void setLineJoinStyle(int lineJoinStyle) throws IOException
lineJoinStyle
- 0 for miter join, 1 for round join, and 2 for bevel join.IOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.IllegalArgumentException
- If the parameter is not a valid line join style.public void setLineCapStyle(int lineCapStyle) throws IOException
lineCapStyle
- 0 for butt cap, 1 for round cap, and 2 for projecting square cap.IOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.IllegalArgumentException
- If the parameter is not a valid line cap style.public void setLineDashPattern(float[] pattern, float phase) throws IOException
pattern
- The pattern arrayphase
- The phase of the patternIOException
- If the content stream could not be written.IllegalStateException
- If the method was called within a text block.public void setMiterLimit(float miterLimit) throws IOException
miterLimit
- the new miter limit.IOException
- If the content stream could not be written.@Deprecated public void beginMarkedContentSequence(COSName tag) throws IOException
beginMarkedContent(org.apache.pdfbox.cos.COSName)
instead.tag
- the tagIOException
- if an I/O error occurspublic void beginMarkedContent(COSName tag) throws IOException
tag
- the tagIOException
- If the content stream could not be written@Deprecated public void beginMarkedContentSequence(COSName tag, COSName propsName) throws IOException
beginMarkedContent(COSName, PDPropertyList)
instead.tag
- the tagpropsName
- the properties referenceIOException
- if an I/O error occurspublic void beginMarkedContent(COSName tag, PDPropertyList propertyList) throws IOException
tag
- the tagpropertyList
- property listIOException
- If the content stream could not be written@Deprecated public void endMarkedContentSequence() throws IOException
endMarkedContent()
instead.IOException
- If the content stream could not be writtenpublic void endMarkedContent() throws IOException
IOException
- If the content stream could not be written@Deprecated public void appendRawCommands(String commands) throws IOException
commands
- The commands to append to the stream.IOException
- If an error occurs while writing to the stream.@Deprecated public void appendRawCommands(byte[] commands) throws IOException
commands
- The commands to append to the stream.IOException
- If an error occurs while writing to the stream.@Deprecated public void appendRawCommands(int data) throws IOException
data
- Append a raw byte to the stream.IOException
- If an error occurs while writing to the stream.@Deprecated public void appendRawCommands(double data) throws IOException
data
- Append a formatted double value to the stream.IOException
- If an error occurs while writing to the stream.@Deprecated public void appendRawCommands(float data) throws IOException
data
- Append a formatted float value to the stream.IOException
- If an error occurs while writing to the stream.@Deprecated public void appendCOSName(COSName name) throws IOException
COSName
to the content stream.name
- the nameIOException
- If an error occurs while writing to the stream.public void setGraphicsStateParameters(PDExtendedGraphicsState state) throws IOException
state
- The extended graphics state.IOException
- If the content stream could not be written.public void addComment(String comment) throws IOException
comment
- IOException
- If the content stream could not be written.IllegalArgumentException
- If the comment contains a newline. This is not allowed,
because the next line could be ordinary PDF content.protected void writeOperand(float real) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- If the underlying stream has a problem being written to.public void setRenderingMode(RenderingMode rm) throws IOException
rm
- The text rendering mode.IOException
- If the content stream could not be written.public void setCharacterSpacing(float spacing) throws IOException
spacing
- character spacingIOException
- If the content stream could not be written.public void setWordSpacing(float spacing) throws IOException
spacing
- word spacingIOException
- If the content stream could not be written.Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.