Package org.apache.pdfbox.pdmodel
Class PDAppearanceContentStream
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.PDAbstractContentStream
-
- org.apache.pdfbox.pdmodel.PDAppearanceContentStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class PDAppearanceContentStream extends PDAbstractContentStream implements java.io.Closeable
Provides the ability to write to an appearance content stream.
-
-
Field Summary
-
Fields inherited from class org.apache.pdfbox.pdmodel.PDAbstractContentStream
document, fontStack, inTextMode, nonStrokingColorSpaceStack, outputStream, resources, strokingColorSpaceStack
-
-
Constructor Summary
Constructors Constructor Description PDAppearanceContentStream(PDAppearanceStream appearance)
Create a new appearance stream.PDAppearanceContentStream(PDAppearanceStream appearance, boolean compress)
Create a new appearance stream.PDAppearanceContentStream(PDAppearanceStream appearance, java.io.OutputStream outputStream)
Create a new appearance stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
drawShape(float lineWidth, boolean hasStroke, boolean hasFill)
Draw a shape.void
setBorderLine(float lineWidth, PDBorderStyleDictionary bs, COSArray border)
Convenience method for annotations: sets the line with and dash style.void
setLineWidthOnDemand(float lineWidth)
Sets the line width.void
setNonStrokingColor(float[] components)
Set the non stroking color.boolean
setNonStrokingColorOnDemand(PDColor color)
Set the non stroking color.void
setStrokingColor(float[] components)
Set the stroking color.boolean
setStrokingColorOnDemand(PDColor color)
Set the stroking color.-
Methods inherited from class org.apache.pdfbox.pdmodel.PDAbstractContentStream
addComment, addRect, beginMarkedContent, beginMarkedContent, beginText, clip, clipEvenOdd, close, closeAndFillAndStroke, closeAndFillAndStrokeEvenOdd, closeAndStroke, closePath, curveTo, curveTo1, curveTo2, drawForm, drawImage, drawImage, drawImage, drawImage, drawImage, endMarkedContent, endText, fill, fillAndStroke, fillAndStrokeEvenOdd, fillEvenOdd, getName, isOutside255Interval, lineTo, moveTo, newLine, newLineAtOffset, restoreGraphicsState, saveGraphicsState, setCharacterSpacing, setFont, setGraphicsStateParameters, setHorizontalScaling, setLeading, setLineCapStyle, setLineDashPattern, setLineJoinStyle, setLineWidth, setMaximumFractionDigits, setMiterLimit, setNonStrokingColor, setNonStrokingColor, setNonStrokingColor, setNonStrokingColor, setNonStrokingColor, setNonStrokingColor, setNonStrokingColor, setNonStrokingColor, setNonStrokingColorSpaceStack, setRenderingMode, setStrokingColor, setStrokingColor, setStrokingColor, setStrokingColor, setStrokingColor, setStrokingColor, setStrokingColorSpaceStack, setTextMatrix, setTextRise, setWordSpacing, shadingFill, showText, showTextInternal, showTextWithPositioning, stroke, transform, write, write, writeBytes, writeLine, writeOperand, writeOperand, writeOperand, writeOperator
-
-
-
-
Constructor Detail
-
PDAppearanceContentStream
public PDAppearanceContentStream(PDAppearanceStream appearance) throws java.io.IOException
Create a new appearance stream.- Parameters:
appearance
- The appearance stream to write to.- Throws:
java.io.IOException
- If there is an error writing to the content stream.
-
PDAppearanceContentStream
public PDAppearanceContentStream(PDAppearanceStream appearance, boolean compress) throws java.io.IOException
Create a new appearance stream.- Parameters:
appearance
- The appearance stream to write to.compress
- whether the content stream is to be compressed. Set this to true when creating long content streams.- Throws:
java.io.IOException
- If there is an error writing to the content stream.
-
PDAppearanceContentStream
public PDAppearanceContentStream(PDAppearanceStream appearance, java.io.OutputStream outputStream)
Create a new appearance stream.- Parameters:
appearance
- The appearance stream to add to.outputStream
- The appearances output stream to write to.
-
-
Method Detail
-
setStrokingColorOnDemand
public boolean setStrokingColorOnDemand(PDColor color) throws java.io.IOException
Set the stroking color.The command is only emitted if the color is not null and the number of components is > 0.
- Parameters:
color
- The colorspace to write.- Throws:
java.io.IOException
- If there is an error writing to the content stream.- See Also:
PDAbstractContentStream.setStrokingColor(PDColor)
-
setStrokingColor
public void setStrokingColor(float[] components) throws java.io.IOException
Set the stroking color.- Parameters:
components
- the color components dependent on the color space being used.- Throws:
java.io.IOException
- If there is an error writing to the content stream.- See Also:
PDAbstractContentStream.setStrokingColor(java.awt.Color)
-
setNonStrokingColorOnDemand
public boolean setNonStrokingColorOnDemand(PDColor color) throws java.io.IOException
Set the non stroking color.The command is only emitted if the color is not null and the number of components is > 0.
- Parameters:
color
- The colorspace to write.- Throws:
java.io.IOException
- If there is an error writing to the content stream.- See Also:
PDAbstractContentStream.setNonStrokingColor(PDColor)
-
setNonStrokingColor
public void setNonStrokingColor(float[] components) throws java.io.IOException
Set the non stroking color.- Parameters:
components
- the color components dependent on the color space being used.- Throws:
java.io.IOException
- If there is an error writing to the content stream.- See Also:
PDAbstractContentStream.setNonStrokingColor(java.awt.Color)
-
setBorderLine
public void setBorderLine(float lineWidth, PDBorderStyleDictionary bs, COSArray border) throws java.io.IOException
Convenience method for annotations: sets the line with and dash style.- Parameters:
lineWidth
- The line width.bs
- The border style, may be null.border
- The border array, must have at least three entries. This is only used if the border style is null.- Throws:
java.io.IOException
- If there is an error writing to the content stream.
-
setLineWidthOnDemand
public void setLineWidthOnDemand(float lineWidth) throws java.io.IOException
Sets the line width. The command is only emitted if the lineWidth is different to 1.- Parameters:
lineWidth
- the line width of the path.- Throws:
java.io.IOException
- If there is an error writing to the content stream.- See Also:
PDAbstractContentStream.setLineWidth(float)
-
drawShape
public void drawShape(float lineWidth, boolean hasStroke, boolean hasFill) throws java.io.IOException
Draw a shape.Dependent on the lineWidth and whether or not there is a background to be generated there are different commands to be used for draw a shape.
- Parameters:
lineWidth
- the line width of the path.hasStroke
- shall there be a stroking color.hasFill
- shall there be a fill color.- Throws:
java.io.IOException
- If there is an error writing to the content stream.
-
-