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 doc,
PDFormXObject form,
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.
|
PDPageContentStream(PDDocument doc,
PDTilingPattern pattern,
OutputStream outputStream)
Create a new appearance 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.
Usage of this method is discouraged.
|
void |
appendRawCommands(byte[] commands)
Deprecated.
Usage of this method is discouraged.
|
void |
appendRawCommands(double data)
Deprecated.
Usage of this method is discouraged.
|
void |
appendRawCommands(float data)
Deprecated.
Usage of this method is discouraged.
|
void |
appendRawCommands(int data)
Deprecated.
Usage of this method is discouraged.
|
void |
appendRawCommands(String commands)
Deprecated.
Usage of this method is discouraged.
|
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.
Use
moveto(xStart,yStart) followed by
lineTo(xEnd,yEnd) followed by stroke() . |
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.
Use
drawImage(PDImageXObject, Matrix)
or drawForm(PDFormXObject) with
transform(Matrix) instead. |
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 |
setHorizontalScaling(float scale)
Set the horizontal scaling to scale / 100.
|
void |
setLeading(double leading)
Deprecated.
|
void |
setLeading(float 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)
Deprecated.
|
void |
setNonStrokingColor(double c,
double m,
double y,
double k)
Deprecated.
|
void |
setNonStrokingColor(float g)
Set the non-stroking color in the DeviceGray color space.
|
void |
setNonStrokingColor(float[] components)
Deprecated.
Use
setNonStrokingColor(PDColor) instead. |
void |
setNonStrokingColor(float c,
float m,
float y,
float k)
Set the non-stroking color in the DeviceCMYK color space.
|
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.
Use
setNonStrokingColor(PDColor) instead. |
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)
Deprecated.
|
void |
setStrokingColor(float 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(float) 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 |
setTextRise(float rise)
Set the text rise value, i.e.
|
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.
|
protected void |
showTextInternal(String text)
Outputs a string using the correct encoding and subsetting as required.
|
void |
showTextWithPositioning(Object[] textWithPositioningArray)
Shows the given text at the location specified by the current text matrix with the given
interspersed positioning.
|
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
PDPageContentStream.AppendMode.APPEND
, you may want to use
PDPageContentStream(PDDocument, PDPage, PDPageContentStream.AppendMode, boolean, boolean)
instead, with the fifth parameter set to true.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 PDPageContentStream(PDDocument doc, PDFormXObject form, OutputStream outputStream) throws IOException
doc
- The document the appearance is part of.form
- The XObject form to add to.outputStream
- The output stream to write to.IOException
- If there is an error writing to the page contents.public PDPageContentStream(PDDocument doc, PDTilingPattern pattern, OutputStream outputStream) throws IOException
doc
- The document the appearance is part of.pattern
- The pattern to add to.outputStream
- The 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 showTextWithPositioning(Object[] textWithPositioningArray) throws IOException
textWithPositioningArray
- An array consisting of String and Float types. Each String is
output to the page using the current text matrix. Using the default coordinate system, each
interspersed number adjusts the current text matrix by translating to the left or down for
horizontal and vertical text respectively. The number is expressed in thousands of a text
space unit, and may be negative.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.IllegalArgumentException
- if a character isn't supported by the current fontprotected void showTextInternal(String text) throws IOException
text
- The Unicode text to show.IOException
- If an io exception occurs.@Deprecated public void setLeading(double leading) throws IOException
setLeading(float)
leading
- The leading in unscaled text units.IOException
- If there is an error writing to the stream.public void setLeading(float 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(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(float)
instead.g
- The gray value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameter is invalid.@Deprecated public void setStrokingColor(double g) throws IOException
setStrokingColor(float)
g
- The gray value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameter is invalid.public void setStrokingColor(float 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.@Deprecated public void setNonStrokingColor(double c, double m, double y, double k) throws IOException
setNonStrokingColor(float, float, float, float)
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(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.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.@Deprecated public void setNonStrokingColor(double g) throws IOException
setNonStrokingColor(float)
g
- The gray value.IOException
- If an IO error occurs while writing to the stream.IllegalArgumentException
- If the parameter is invalid.public void setNonStrokingColor(float 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
addRect(float, float, float, float)
followed by fill()
instead.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
moveto(xStart,yStart)
followed by
lineTo(xEnd,yEnd)
.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
moveto(xStart,yStart)
followed by
lineTo(xEnd,yEnd)
followed by stroke()
.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
moveTo(float, float)
and lineTo(float, float)
methods instead.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
moveTo(float, float)
and lineTo(float, float)
methods instead.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
moveTo(float, float)
and lineTo(float, float)
methods instead.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
fill()
or fillEvenOdd()
instead.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
clip()
or clipEvenOdd()
instead.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 drawing.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
- the comment to be added to the content stream.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
real
- the float value to be added to the content stream.IOException
- if something went wrongpublic 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
This will have an effect only with Type1 and TrueType fonts, not with Type0 fonts. The PDF specification tells why: "Word spacing shall be applied to every occurrence of the single-byte character code 32 in a string when using a simple font or a composite font that defines code 32 as a single-byte code. It shall not apply to occurrences of the byte value 32 in multiple-byte codes."
spacing
- word spacingIOException
- If the content stream could not be written.public void setHorizontalScaling(float scale) throws IOException
scale
- number specifying the percentage of the normal width. Default value: 100 (normal
width).IOException
- If the content stream could not be written.public void setTextRise(float rise) throws IOException
rise
- Specifies the distance, in unscaled text space units, to move the baseline up or
down from its default location. 0 restores the default location.IOException
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.