@CodingStyleguideUnaware @NotThreadSafe public final class PDPageContentStreamExt extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
protected OutputStream |
m_aOS |
| Constructor and Description |
|---|
PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument doc,
org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream appearance)
Create a new appearance stream.
|
PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument doc,
org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream appearance,
OutputStream outputStream)
Create a new appearance stream.
|
PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPage sourcePage)
Create a new PDPage content stream.
|
PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPage sourcePage,
org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode appendContent,
boolean compress)
Create a new PDPage content stream.
|
PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPage sourcePage,
org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode appendContent,
boolean compress,
boolean resetContext)
Create a new PDPage content stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRect(float x,
float y,
float width,
float height)
Add a rectangle to the current path.
|
void |
beginMarkedContent(org.apache.pdfbox.cos.COSName tag)
Begin a marked content sequence.
|
void |
beginMarkedContent(org.apache.pdfbox.cos.COSName tag,
org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList propertyList)
Begin a marked content sequence with a reference to an entry in the page
resources' Properties dictionary.
|
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 |
close()
Close the content stream.
|
void |
closeAndStroke()
Close and stroke the path.
|
void |
closePath()
Closes the current subpath.
|
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(org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject form)
Draws the given Form XObject at the current location.
|
void |
drawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject image,
float x,
float y)
Draw an image at the x,y coordinates, with the default size of the image.
|
void |
drawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject image,
float x,
float y,
float width,
float height)
Draw an image at the x,y coordinates, with the given size.
|
void |
drawImage(org.apache.pdfbox.pdmodel.graphics.image.PDInlineImage inlineImage,
float x,
float y)
Draw an inline image at the x,y coordinates, with the default size of the
image.
|
void |
drawImage(org.apache.pdfbox.pdmodel.graphics.image.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 |
endMarkedContent()
End a marked content sequence.
|
void |
endText()
End some text operations.
|
void |
fill()
Fills the path using the nonzero winding rule.
|
void |
fillEvenOdd()
Fills the path using the even-odd winding rule.
|
void |
lineTo(float x,
float y)
Draw a line from the current position to the given coordinates.
|
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 |
setFont(org.apache.pdfbox.pdmodel.font.PDFont font,
float fontSize)
Set the font and font size to draw text with.
|
void |
setGraphicsStateParameters(org.apache.pdfbox.pdmodel.graphics.state.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 |
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(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(org.apache.pdfbox.pdmodel.graphics.color.PDColor color)
Sets the non-stroking color and, if necessary, the non-stroking color
space.
|
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 c,
float m,
float y,
float k)
Set the stroking color in the DeviceCMYK color space.
|
void |
setStrokingColor(int r,
int g,
int b)
Set the stroking color in the DeviceRGB color space.
|
void |
setStrokingColor(org.apache.pdfbox.pdmodel.graphics.color.PDColor color)
Sets the stroking color and, if necessary, the stroking color space.
|
void |
setTextMatrix(org.apache.pdfbox.util.Matrix matrix)
The Tm operator.
|
void |
shadingFill(org.apache.pdfbox.pdmodel.graphics.shading.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(org.apache.pdfbox.util.Matrix matrix)
The cm operator.
|
protected void |
write(String text)
Writes a string to the content stream as ASCII.
|
protected void |
writeBytes(byte[] data)
Writes binary data to the content stream.
|
protected void |
writeLine()
Writes a string to the content stream as ASCII.
|
protected void |
writeOperand(org.apache.pdfbox.cos.COSName name)
Writes a COSName to the content stream.
|
protected void |
writeOperand(float real)
Writes a real real to the content stream.
|
protected void |
writeOperand(int integer)
Writes a real number to the content stream.
|
protected void |
writeOperator(String text)
Writes a string to the content stream as ASCII.
|
protected OutputStream m_aOS
public PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.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.public PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPage sourcePage,
org.apache.pdfbox.pdmodel.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. 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 PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPage sourcePage,
org.apache.pdfbox.pdmodel.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. 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.IOException - If there is an error writing to the page contents.public PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument doc,
org.apache.pdfbox.pdmodel.interactive.annotation.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 PDPageContentStreamExt(org.apache.pdfbox.pdmodel.PDDocument doc,
org.apache.pdfbox.pdmodel.interactive.annotation.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(org.apache.pdfbox.pdmodel.font.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.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.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.public void setTextMatrix(org.apache.pdfbox.util.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.public void drawImage(org.apache.pdfbox.pdmodel.graphics.image.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(org.apache.pdfbox.pdmodel.graphics.image.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(org.apache.pdfbox.pdmodel.graphics.image.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.public void drawImage(org.apache.pdfbox.pdmodel.graphics.image.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.public void drawForm(org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject form)
throws IOException
form - Form XObjectIOException - if the content stream could not be writtenIllegalStateException - If the method was called within a text block.public void transform(org.apache.pdfbox.util.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.public void setStrokingColor(org.apache.pdfbox.pdmodel.graphics.color.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.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.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.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(org.apache.pdfbox.pdmodel.graphics.color.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.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.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.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.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.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.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 shadingFill(org.apache.pdfbox.pdmodel.graphics.shading.PDShading shading)
throws IOException
shading - Shading resourceIOException - If the content stream could not be writtenIllegalStateException - If the method was called within a text block.public void closePath()
throws IOException
IOException - If the content stream could not be writtenIllegalStateException - 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 beginMarkedContent(org.apache.pdfbox.cos.COSName tag)
throws IOException
tag - the tagIOException - If the content stream could not be writtenpublic void beginMarkedContent(org.apache.pdfbox.cos.COSName tag,
org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList propertyList)
throws IOException
tag - the tagpropertyList - property listIOException - If the content stream could not be writtenpublic void endMarkedContent()
throws IOException
IOException - If the content stream could not be writtenpublic void setGraphicsStateParameters(org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState state)
throws IOException
state - The extended graphics state.IOException - If the content stream could not be written.protected void writeOperand(float real)
throws IOException
IOExceptionprotected void writeOperand(int integer)
throws IOException
IOExceptionprotected void writeOperand(org.apache.pdfbox.cos.COSName name)
throws IOException
IOExceptionprotected void writeOperator(String text) throws IOException
IOExceptionprotected void write(String text) throws IOException
IOExceptionprotected void writeLine()
throws IOException
IOExceptionprotected void writeBytes(byte[] data)
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - If the underlying stream has a problem being written to.Copyright © 2014–2016 Philip Helger. All rights reserved.