Package org.apache.pdfbox.pdmodel
Class PDAppearanceContentStream
java.lang.Object
org.apache.pdfbox.pdmodel.PDAbstractContentStream
org.apache.pdfbox.pdmodel.PDAppearanceContentStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
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
ConstructorsConstructorDescriptionPDAppearanceContentStream
(PDAppearanceStream appearance) Create a new appearance stream.PDAppearanceContentStream
(PDAppearanceStream appearance, boolean compress) Create a new appearance stream.PDAppearanceContentStream
(PDAppearanceStream appearance, OutputStream outputStream) Create a new appearance stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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 Details
-
PDAppearanceContentStream
Create a new appearance stream.- Parameters:
appearance
- The appearance stream to write to.- Throws:
IOException
- If there is an error writing to the content stream.
-
PDAppearanceContentStream
public PDAppearanceContentStream(PDAppearanceStream appearance, boolean compress) throws 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:
IOException
- If there is an error writing to the content stream.
-
PDAppearanceContentStream
Create a new appearance stream.- Parameters:
appearance
- The appearance stream to add to.outputStream
- The appearances output stream to write to.
-
-
Method Details
-
setStrokingColorOnDemand
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:
IOException
- If there is an error writing to the content stream.- See Also:
-
setStrokingColor
Set the stroking color.- Parameters:
components
- the color components dependent on the color space being used.- Throws:
IOException
- If there is an error writing to the content stream.- See Also:
-
setNonStrokingColorOnDemand
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:
IOException
- If there is an error writing to the content stream.- See Also:
-
setNonStrokingColor
Set the non stroking color.- Parameters:
components
- the color components dependent on the color space being used.- Throws:
IOException
- If there is an error writing to the content stream.- See Also:
-
setBorderLine
public void setBorderLine(float lineWidth, PDBorderStyleDictionary bs, COSArray border) throws 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:
IOException
- If there is an error writing to the content stream.
-
setLineWidthOnDemand
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:
IOException
- If there is an error writing to the content stream.- See Also:
-
drawShape
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:
IOException
- If there is an error writing to the content stream.
-