Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.state

public Class PDExtendedGraphicsState

extends Object
implements COSObjectable
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.COSObjectable
Imports
java.io.IOException, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSFloat, .COSName, .COSNumber, org.apache.pdfbox.pdmodel.common.COSObjectable, org.apache.pdfbox.pdmodel.graphics.PDFontSetting, .PDLineDashPattern, org.apache.pdfbox.pdmodel.graphics.blend.BlendMode

An extended graphics state dictionary.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private final COSDictionary

Constructor Summary

AccessConstructor and Description
public
PDExtendedGraphicsState()

Default constructor, creates blank graphics state.

public
PDExtendedGraphicsState(COSDictionary
The existing graphics state.
dictionary
)

Create a graphics state from an existing dictionary.

Method Summary

Modifier and TypeMethod and Description
public void
copyIntoGraphicsState(PDGraphicsState
The state to copy this dictionaries values into.
gs
)

This will implement the gs operator.

private float

Returns:

'standard' value if not null otherwise default value
defaultIfNull
(Float
'standard' value
standardValue
,
float
default value
defaultValue
)

Returns the provided default value in case 'standard' value is null.

public boolean

Returns:

The alpha source flag.
getAlphaSourceFlag
()

This will get the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).

public boolean

Returns:

The automatic stroke adjustment flag or null if one has not been set.
getAutomaticStrokeAdjustment
()

This will get the automatic stroke adjustment flag.

public BlendMode

Returns:

the blending mode
getBlendMode
()

Returns the blending mode stored in the COS dictionary

public COSDictionary

Returns:

The underlying dictionary for this class.
getCOSObject
()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

This will get the underlying dictionary that this class acts on.

public Float

Returns:

The flatness tolerance or null if one has not been set.
getFlatnessTolerance
()

This will get the flatness tolerance.

private Float

Returns:

The value for that item.
getFloatItem
(COSName
The key to the item.
key
)

This will get a float item from the dictionary.

public PDFontSetting

Returns:

The font setting.
getFontSetting
()

This will get the font setting of the graphics state.

public int

Returns:

null or the LC value of the dictionary.
getLineCapStyle
()

This will get the line cap style.

public PDLineDashPattern

Returns:

null or the D value in the dictionary.
getLineDashPattern
()

This will get the dash pattern.

public int

Returns:

null or the LJ value in the dictionary.
getLineJoinStyle
()

This will get the line join style.

public Float

Returns:

null or the LW value of the dictionary.
getLineWidth
()

This will get the line width.

public Float

Returns:

null or the ML value in the dictionary.
getMiterLimit
()

This will get the miter limit.

public Float

Returns:

The non stroking alpha constant or null if one has not been set.
getNonStrokingAlphaConstant
()

This will get the non stroking alpha constant.

public boolean

Returns:

The overprint control or null if one has not been set.
getNonStrokingOverprintControl
()

This will get the overprint control for non stroking operations.

public Integer

Returns:

The overprint control mode or null if one has not been set.
getOverprintMode
()

This will get the overprint control mode.

public RenderingIntent

Returns:

null or the RI value in the dictionary.
getRenderingIntent
()

This will get the rendering intent.

public Float

Returns:

The smothness tolerance or null if one has not been set.
getSmoothnessTolerance
()

This will get the smothness tolerance.

public PDSoftMask

Returns:

the soft mask or null if there isn't any.
getSoftMask
()

Returns the soft mask stored in the COS dictionary

public Float

Returns:

The stroking alpha constant or null if one has not been set.
getStrokingAlphaConstant
()

This will get the stroking alpha constant.

public boolean

Returns:

The overprint control or null if one has not been set.
getStrokingOverprintControl
()

This will get the overprint control.

public boolean

Returns:

The text knockout flag.
getTextKnockoutFlag
()

/** This will get the text knockout flag.

public COSBase

Returns:

The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function.
getTransfer
()

This will get the transfer function of the /TR dictionary.

public COSBase

Returns:

The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function, and the name Default denotes the transfer function that was in effect at the start of the page.
getTransfer2
()

This will get the transfer function of the /TR2 dictionary.

public void
setAlphaSourceFlag(boolean
The alpha source flag.
alpha
)

This will set the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).

public void
setAutomaticStrokeAdjustment(boolean
The new automatic stroke adjustment flag.
sa
)

This will set the automatic stroke adjustment flag.

public void
setBlendMode(BlendMode
blend mode
bm
)

Set the blending mode.

public void
setFlatnessTolerance(Float
The new flatness tolerance
flatness
)

This will set the flatness tolerance.

private void
setFloatItem(COSName
The key to the data that we are setting.
key
,
Float
The value that we are setting.
value
)

This will set a float object.

public void
setFontSetting(PDFontSetting
The new font setting.
fs
)

This will set the font setting for this graphics state.

public void
setLineCapStyle(int
The new line cap style to set.
style
)

This will set the line cap style for the graphics state.

public void
setLineDashPattern(PDLineDashPattern
The dash pattern
dashPattern
)

This will set the dash pattern for the graphics state.

public void
setLineJoinStyle(int
The new line join style.
style
)

This will set the line join style.

public void
setLineWidth(Float
The line width for the object.
width
)

This will set the line width.

public void
setMiterLimit(Float
The new miter limit value
miterLimit
)

This will set the miter limit for the graphics state.

public void
setNonStrokingAlphaConstant(Float
The new non stroking alpha constant.
alpha
)

This will set the non stroking alpha constant.

public void
setNonStrokingOverprintControl(boolean
The overprint control.
op
)

This will set the overprint control(OP).

public void
setOverprintMode(Integer
The overprint mode
overprintMode
)

This will set the overprint mode(OPM).

public void
setRenderingIntent(String
The new rendering intent
ri
)

This will set the rendering intent for the graphics state.

public void
setSmoothnessTolerance(Float
The new smoothness tolerance
smoothness
)

This will set the smoothness tolerance.

public void
setStrokingAlphaConstant(Float
The new stroking alpha constant.
alpha
)

This will set the stroking alpha constant.

public void
setStrokingOverprintControl(boolean
The overprint control.
op
)

This will set the overprint control(OP).

public void
setTextKnockoutFlag(boolean
The text knockout flag.
tk
)

This will set the text knockout flag.

public void
setTransfer(COSBase
The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function.
transfer
)

This will set the transfer function of the /TR dictionary.

public void
setTransfer2(COSBase
The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function, and the name Default denotes the transfer function that was in effect at the start of the page.
transfer2
)

This will set the transfer function of the /TR2 dictionary.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dictback to summary
private final COSDictionary dict

Constructor Detail

PDExtendedGraphicsStateback to summary
public PDExtendedGraphicsState()

Default constructor, creates blank graphics state.

PDExtendedGraphicsStateback to summary
public PDExtendedGraphicsState(COSDictionary dictionary)

Create a graphics state from an existing dictionary.

Parameters
dictionary:COSDictionary

The existing graphics state.

Method Detail

copyIntoGraphicsStateback to summary
public void copyIntoGraphicsState(PDGraphicsState gs) throws IOException

This will implement the gs operator.

Parameters
gs:PDGraphicsState

The state to copy this dictionaries values into.

Exceptions
IOException:
If there is an error copying font information.
defaultIfNullback to summary
private float defaultIfNull(Float standardValue, float defaultValue)

Returns the provided default value in case 'standard' value is null. To be used in cases unboxing may lead to a NPE.

Parameters
standardValue:Float

'standard' value

defaultValue:float

default value

Returns:float

'standard' value if not null otherwise default value

getAlphaSourceFlagback to summary
public boolean getAlphaSourceFlag()

This will get the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).

Returns:boolean

The alpha source flag.

getAutomaticStrokeAdjustmentback to summary
public boolean getAutomaticStrokeAdjustment()

This will get the automatic stroke adjustment flag.

Returns:boolean

The automatic stroke adjustment flag or null if one has not been set.

getBlendModeback to summary
public BlendMode getBlendMode()

Returns the blending mode stored in the COS dictionary

Returns:BlendMode

the blending mode

getCOSObjectback to summary
public COSDictionary getCOSObject()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

This will get the underlying dictionary that this class acts on.

Returns:COSDictionary

The underlying dictionary for this class.

Annotations
@Override
getFlatnessToleranceback to summary
public Float getFlatnessTolerance()

This will get the flatness tolerance.

Returns:Float

The flatness tolerance or null if one has not been set.

getFloatItemback to summary
private Float getFloatItem(COSName key)

This will get a float item from the dictionary.

Parameters
key:COSName

The key to the item.

Returns:Float

The value for that item.

getFontSettingback to summary
public PDFontSetting getFontSetting()

This will get the font setting of the graphics state.

Returns:PDFontSetting

The font setting.

getLineCapStyleback to summary
public int getLineCapStyle()

This will get the line cap style.

Returns:int

null or the LC value of the dictionary.

getLineDashPatternback to summary
public PDLineDashPattern getLineDashPattern()

This will get the dash pattern.

Returns:PDLineDashPattern

null or the D value in the dictionary.

getLineJoinStyleback to summary
public int getLineJoinStyle()

This will get the line join style.

Returns:int

null or the LJ value in the dictionary.

getLineWidthback to summary
public Float getLineWidth()

This will get the line width. This will return null if there is no line width

Returns:Float

null or the LW value of the dictionary.

getMiterLimitback to summary
public Float getMiterLimit()

This will get the miter limit.

Returns:Float

null or the ML value in the dictionary.

getNonStrokingAlphaConstantback to summary
public Float getNonStrokingAlphaConstant()

This will get the non stroking alpha constant.

Returns:Float

The non stroking alpha constant or null if one has not been set.

getNonStrokingOverprintControlback to summary
public boolean getNonStrokingOverprintControl()

This will get the overprint control for non stroking operations. If this value is null then the regular overprint control value will be returned.

Returns:boolean

The overprint control or null if one has not been set.

getOverprintModeback to summary
public Integer getOverprintMode()

This will get the overprint control mode.

Returns:Integer

The overprint control mode or null if one has not been set.

getRenderingIntentback to summary
public RenderingIntent getRenderingIntent()

This will get the rendering intent.

Returns:RenderingIntent

null or the RI value in the dictionary.

getSmoothnessToleranceback to summary
public Float getSmoothnessTolerance()

This will get the smothness tolerance.

Returns:Float

The smothness tolerance or null if one has not been set.

getSoftMaskback to summary
public PDSoftMask getSoftMask()

Returns the soft mask stored in the COS dictionary

Returns:PDSoftMask

the soft mask or null if there isn't any.

getStrokingAlphaConstantback to summary
public Float getStrokingAlphaConstant()

This will get the stroking alpha constant.

Returns:Float

The stroking alpha constant or null if one has not been set.

getStrokingOverprintControlback to summary
public boolean getStrokingOverprintControl()

This will get the overprint control.

Returns:boolean

The overprint control or null if one has not been set.

getTextKnockoutFlagback to summary
public boolean getTextKnockoutFlag()

/** This will get the text knockout flag.

Returns:boolean

The text knockout flag.

getTransferback to summary
public COSBase getTransfer()

This will get the transfer function of the /TR dictionary.

Returns:COSBase

The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function.

getTransfer2back to summary
public COSBase getTransfer2()

This will get the transfer function of the /TR2 dictionary.

Returns:COSBase

The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function, and the name Default denotes the transfer function that was in effect at the start of the page.

setAlphaSourceFlagback to summary
public void setAlphaSourceFlag(boolean alpha)

This will set the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).

Parameters
alpha:boolean

The alpha source flag.

setAutomaticStrokeAdjustmentback to summary
public void setAutomaticStrokeAdjustment(boolean sa)

This will set the automatic stroke adjustment flag.

Parameters
sa:boolean

The new automatic stroke adjustment flag.

setBlendModeback to summary
public void setBlendMode(BlendMode bm)

Set the blending mode.

Parameters
bm:BlendMode

blend mode

setFlatnessToleranceback to summary
public void setFlatnessTolerance(Float flatness)

This will set the flatness tolerance.

Parameters
flatness:Float

The new flatness tolerance

setFloatItemback to summary
private void setFloatItem(COSName key, Float value)

This will set a float object.

Parameters
key:COSName

The key to the data that we are setting.

value:Float

The value that we are setting.

setFontSettingback to summary
public void setFontSetting(PDFontSetting fs)

This will set the font setting for this graphics state.

Parameters
fs:PDFontSetting

The new font setting.

setLineCapStyleback to summary
public void setLineCapStyle(int style)

This will set the line cap style for the graphics state.

Parameters
style:int

The new line cap style to set.

setLineDashPatternback to summary
public void setLineDashPattern(PDLineDashPattern dashPattern)

This will set the dash pattern for the graphics state.

Parameters
dashPattern:PDLineDashPattern

The dash pattern

setLineJoinStyleback to summary
public void setLineJoinStyle(int style)

This will set the line join style.

Parameters
style:int

The new line join style.

setLineWidthback to summary
public void setLineWidth(Float width)

This will set the line width.

Parameters
width:Float

The line width for the object.

setMiterLimitback to summary
public void setMiterLimit(Float miterLimit)

This will set the miter limit for the graphics state.

Parameters
miterLimit:Float

The new miter limit value

setNonStrokingAlphaConstantback to summary
public void setNonStrokingAlphaConstant(Float alpha)

This will set the non stroking alpha constant.

Parameters
alpha:Float

The new non stroking alpha constant.

setNonStrokingOverprintControlback to summary
public void setNonStrokingOverprintControl(boolean op)

This will set the overprint control(OP).

Parameters
op:boolean

The overprint control.

setOverprintModeback to summary
public void setOverprintMode(Integer overprintMode)

This will set the overprint mode(OPM).

Parameters
overprintMode:Integer

The overprint mode

setRenderingIntentback to summary
public void setRenderingIntent(String ri)

This will set the rendering intent for the graphics state.

Parameters
ri:String

The new rendering intent

setSmoothnessToleranceback to summary
public void setSmoothnessTolerance(Float smoothness)

This will set the smoothness tolerance.

Parameters
smoothness:Float

The new smoothness tolerance

setStrokingAlphaConstantback to summary
public void setStrokingAlphaConstant(Float alpha)

This will set the stroking alpha constant.

Parameters
alpha:Float

The new stroking alpha constant.

setStrokingOverprintControlback to summary
public void setStrokingOverprintControl(boolean op)

This will set the overprint control(OP).

Parameters
op:boolean

The overprint control.

setTextKnockoutFlagback to summary
public void setTextKnockoutFlag(boolean tk)

This will set the text knockout flag.

Parameters
tk:boolean

The text knockout flag.

setTransferback to summary
public void setTransfer(COSBase transfer)

This will set the transfer function of the /TR dictionary.

Parameters
transfer:COSBase

The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function.

setTransfer2back to summary
public void setTransfer2(COSBase transfer2)

This will set the transfer function of the /TR2 dictionary.

Parameters
transfer2:COSBase

The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function, and the name Default denotes the transfer function that was in effect at the start of the page.