Class PdfExtGState
java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
com.itextpdf.kernel.pdf.extgstate.PdfExtGState
Graphics state parameter dictionary wrapper. See ISO-320001, 8.4.5 Graphics State Parameter Dictionaries.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final PdfName
Standard nonseparable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard nonseparable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard nonseparable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard nonseparable blend mode.static final PdfName
Standard separable blend mode.static final PdfName
Standard separable blend mode. -
Constructor Summary
ConstructorDescriptionCreate default instance of graphics state parameter dictionaryPdfExtGState
(PdfDictionary pdfObject) Create instance of graphics state parameter dictionary wrapper by existedPdfDictionary
object -
Method Summary
Modifier and TypeMethodDescriptionvoid
flush()
To manually flush aPdfObject
behind this wrapper, you have to ensure that this object is added to the document, i.e.Gets the alpha source flag ("alpha is shape"), specifying whether the current soft mask and alpha constant shall be interpreted as shape values (true
) or opacity values (false
),AIS
key.Gets value of an automatic stroke adjustment flag,SA
key.Gets the black-generation function value,BG
.Gets the black-generation function value orDefault
,BG2
key.Gets the current blend mode for the transparent imaging model,BM
key.Gets line dash pattern value,D
key.Gets the current alpha constant, specifying the constant shape or constant opacity value for non-stroking operations in the transparent imaging model,ca
key.Get overprint flag value for non-stroking operations,op
key.Gets the flatness tolerance value,FL
key.getFont()
Gets font and size,Font
key.Gets the halftone dictionary, stream orDefault
,HT
key.float[]
PDF 2.0.Gets line gap style value,LC
key.Gets line join style value,LJ
key.Gets line width value,LW
key.Gets miter limit value,ML key
.Get overprint control mode,OPM
key.Gets rendering intent value,RI
key.Gets the smoothness tolerance value,SM
key.Gets the current soft mask,SMask
key.Gets the current alpha constant, specifying the constant shape or constant opacity value for stroking operations in the transparent imaging model,CA
key.Get overprint flag value for stroking operations,OP
key.Gets the text knockout flag, which determine the behaviour of overlapping glyphs within a text object in the transparent imaging model,TK
key.Gets the transfer function value,TR
key.Gets the transfer function value orDefault
,TR2
key.Gets the undercolor-removal function,UCR
key.Gets the undercolor-removal function value orDefault
,UCR2
key.PDF 2.0.protected boolean
Defines if the object behind this wrapper must be an indirect object in the resultant document.Puts the value into Graphics state parameter dictionary and associates it with the specified key.setAlphaSourceFlag
(boolean alphaSourceFlag) Sets the alpha source flag ("alpha is shape"), specifying whether the current soft mask and alpha constant shall be interpreted as shape values (true
) or opacity values (false
),AIS
key.setAutomaticStrokeAdjustmentFlag
(boolean strokeAdjustment) Sets value of an automatic stroke adjustment flag,SA
key.setBlackGenerationFunction
(PdfObject blackGenerationFunction) Sets the black-generation function value,BG
.setBlackGenerationFunction2
(PdfObject blackGenerationFunction2) Sets the black-generation function value orDefault
,BG2
key.setBlendMode
(PdfObject blendMode) Sets the current blend mode for the transparent imaging model,BM
key.setDashPattern
(PdfArray dashPattern) Sets line dash pattern value,D
key.setFillOpacity
(float fillingAlphaConstant) Sets the current alpha constant, specifying the constant shape or constant opacity value for non-stroking operations in the transparent imaging model,ca
key.setFillOverPrintFlag
(boolean fillOverprintFlag) Set overprint flag value for non-stroking operations,op
key.setFlatnessTolerance
(float flatnessTolerance) Sets the flatness tolerance value,FL
key.Sets font and size,Font
key.setHalftone
(PdfObject halftone) Sets the halftone orDefault
,HT
key.setHalftoneOrigin
(float x, float y) PDF 2.0.setLineCapStyle
(int lineCapStyle) Sets line gap style value,LC
key.setLineJoinStyle
(int lineJoinStyle) Sets line join style value,LJ
key.setLineWidth
(float lineWidth) Sets line width value,LW
key.setMiterLimit
(float miterLimit) Sets miter limit value,ML key
.setOverprintMode
(int overprintMode) Set overprint control mode,OPM
key.setRenderingIntent
(PdfName renderingIntent) Sets rendering intent value,RI
key.setSmoothnessTolerance
(float smoothnessTolerance) Sets the smoothness tolerance value,SM
key.setSoftMask
(PdfObject sMask) Sets the current soft mask,SMask
key.setStrokeOpacity
(float strokingAlphaConstant) Sets the current alpha constant, specifying the constant shape or constant opacity value for stroking operations in the transparent imaging model,CA
key.setStrokeOverPrintFlag
(boolean strokeOverPrintFlag) Set overprint flag value for stroking operations,OP
key.setTextKnockoutFlag
(boolean textKnockoutFlag) Sets the text knockout flag, which determine the behaviour of overlapping glyphs within a text object in the transparent imaging model,TK
key.setTransferFunction
(PdfObject transferFunction) Sets the transfer function value,TR
key.setTransferFunction2
(PdfObject transferFunction2) Sets the transfer function value orDefault
,TR2
key.setUndercolorRemovalFunction
(PdfObject undercolorRemovalFunction) Sets the undercolor-removal function,UCR
key.setUndercolorRemovalFunction2
(PdfObject undercolorRemovalFunction2) Sets the undercolor-removal function value orDefault
,UCR2
key.setUseBlackPointCompensation
(boolean useBlackPointCompensation) PDF 2.0.Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Field Details
-
BM_NORMAL
Standard separable blend mode. See ISO-320001, table 136 -
BM_MULTIPLY
Standard separable blend mode. See ISO-320001, table 136 -
BM_SCREEN
Standard separable blend mode. See ISO-320001, table 136 -
BM_OVERLAY
Standard separable blend mode. See ISO-320001, table 136 -
BM_DARKEN
Standard separable blend mode. See ISO-320001, table 136 -
BM_LIGHTEN
Standard separable blend mode. See ISO-320001, table 136 -
BM_COLOR_DODGE
Standard separable blend mode. See ISO-320001, table 136 -
BM_COLOR_BURN
Standard separable blend mode. See ISO-320001, table 136 -
BM_HARD_LIGHT
Standard separable blend mode. See ISO-320001, table 136 -
BM_SOFT_LIGHT
Standard separable blend mode. See ISO-320001, table 136 -
BM_DIFFERENCE
Standard separable blend mode. See ISO-320001, table 136 -
BM_EXCLUSION
Standard separable blend mode. See ISO-320001, table 136 -
BM_HUE
Standard nonseparable blend mode. See ISO-320001, table 137 -
BM_SATURATION
Standard nonseparable blend mode. See ISO-320001, table 137 -
BM_COLOR
Standard nonseparable blend mode. See ISO-320001, table 137 -
BM_LUMINOSITY
Standard nonseparable blend mode. See ISO-320001, table 137
-
-
Constructor Details
-
PdfExtGState
Create instance of graphics state parameter dictionary wrapper by existedPdfDictionary
object- Parameters:
-
pdfObject
- instance of graphics state parameter dictionary
-
PdfExtGState
public PdfExtGState()Create default instance of graphics state parameter dictionary
-
-
Method Details
-
getLineWidth
Gets line width value,LW
key.- Returns:
-
a
float
value if exist, otherwisenull
.
-
setLineWidth
Sets line width value,LW
key.- Parameters:
-
lineWidth
- afloat
value. - Returns:
- object itself.
-
getLineCapStyle
Gets line gap style value,LC
key.- Returns:
- 0 - butt cap, 1 - round cap, 2 - projecting square cap.
-
setLineCapStyle
Sets line gap style value,LC
key.- Parameters:
-
lineCapStyle
- 0 - butt cap, 1 - round cap, 2 - projecting square cap. - Returns:
- object itself.
-
getLineJoinStyle
Gets line join style value,LJ
key.- Returns:
- 0 - miter join (see also miter limit), 1 - round join, 2 - bevel join.
-
setLineJoinStyle
Sets line join style value,LJ
key.- Parameters:
-
lineJoinStyle
- 0 - miter join (see also miter limit), 1 - round join, 2 - bevel join. - Returns:
- object itself.
-
getMiterLimit
Gets miter limit value,ML key
. See also line join style.- Returns:
-
a
float
value if exist, otherwisenull
.
-
setMiterLimit
Sets miter limit value,ML key
. See also line join style.- Parameters:
-
miterLimit
- afloat
value. - Returns:
- object itself.
-
getDashPattern
Gets line dash pattern value,D
key.- Returns:
-
a
PdfArray
, that represents line dash pattern.
-
setDashPattern
Sets line dash pattern value,D
key.- Parameters:
-
dashPattern
- aPdfArray
, that represents line dash pattern. - Returns:
- object itself.
-
getRenderingIntent
Gets rendering intent value,RI
key. Valid values are:AbsoluteColorimetric
,RelativeColorimetric
,Saturation
,Perceptual
.- Returns:
-
a
PdfName
instance.
-
setRenderingIntent
Sets rendering intent value,RI
key.- Parameters:
-
renderingIntent
- aPdfName
instance, Valid values are:AbsoluteColorimetric
,RelativeColorimetric
,Saturation
,Perceptual
. - Returns:
- object itself.
-
getStrokeOverprintFlag
Get overprint flag value for stroking operations,OP
key.- Returns:
-
a
boolean
value if exist, otherwisenull
.
-
setStrokeOverPrintFlag
Set overprint flag value for stroking operations,OP
key.- Parameters:
-
strokeOverPrintFlag
-true
, for applying overprint for stroking operations. - Returns:
- object itself.
-
getFillOverprintFlag
Get overprint flag value for non-stroking operations,op
key.- Returns:
-
a
boolean
value if exist, otherwisenull
.
-
setFillOverPrintFlag
Set overprint flag value for non-stroking operations,op
key.- Parameters:
-
fillOverprintFlag
-true
, for applying overprint for non-stroking operations. - Returns:
- object itself.
-
getOverprintMode
Get overprint control mode,OPM
key.- Returns:
-
an
int
value if exist, otherwisenull
.
-
setOverprintMode
Set overprint control mode,OPM
key.- Parameters:
-
overprintMode
- anint
value, see ISO-320001, 8.6.7 Overprint Control. - Returns:
- object itself.
-
getFont
Gets font and size,Font
key.- Returns:
-
a
PdfArray
of the form[font size]
, wherefont
shall be an indirect reference to a font dictionary andsize
shall be a number expressed in text space units.
-
setFont
Sets font and size,Font
key. NOTE: If you want add the font object which has just been created, make sure to register the font withPdfDocument.addFont(PdfFont)
method first.- Parameters:
-
font
- aPdfArray
of the form[font size]
, wherefont
shall be an indirect reference to a font dictionary andsize
shall be a number expressed in text space units. - Returns:
- object itself.
-
getBlackGenerationFunction
Gets the black-generation function value,BG
.- Returns:
-
a
PdfObject
, should be an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects).
-
setBlackGenerationFunction
Sets the black-generation function value,BG
.- Parameters:
-
blackGenerationFunction
- aPdfObject
, shall be an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects). - Returns:
- object itself.
-
getBlackGenerationFunction2
Gets the black-generation function value orDefault
,BG2
key.- Returns:
-
the returned value is
PdfObject
value, which is either aPdfName
of a predefined value or an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects).
-
setBlackGenerationFunction2
Sets the black-generation function value orDefault
,BG2
key. Note, if bothBG
andBG2
are present in the same graphics state parameter dictionary,BG2
takes precedence.- Parameters:
-
blackGenerationFunction2
- aPdfObject
value, shall be an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects) orDefault
. - Returns:
- object itself.
-
getUndercolorRemovalFunction
Gets the undercolor-removal function,UCR
key.- Returns:
-
a
PdfObject
, should be an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects).
-
setUndercolorRemovalFunction
Sets the undercolor-removal function,UCR
key.- Parameters:
-
undercolorRemovalFunction
- aPdfObject
, shall be an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects). - Returns:
- object itself.
-
getUndercolorRemovalFunction2
Gets the undercolor-removal function value orDefault
,UCR2
key.- Returns:
-
the returned value is
PdfObject
value, which is either aPdfName
of a predefined value or an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects).
-
setUndercolorRemovalFunction2
Sets the undercolor-removal function value orDefault
,UCR2
key. Note, if bothUCR
andUCR2
are present in the same graphics state parameter dictionary,UCR2
takes precedence.- Parameters:
-
undercolorRemovalFunction2
- aPdfObject
value, shall be an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects) orDefault
. - Returns:
- object itself.
-
getTransferFunction
Gets the transfer function value,TR
key.- Returns:
-
the returned value is
PdfObject
value, which is either aPdfName
orPdfArray
of a predefined value or an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects).
-
setTransferFunction
Sets the transfer function value,TR
key.- Parameters:
-
transferFunction
- aPdfObject
, shall be either aPdfName
orPdfArray
of a predefined value or an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects). - Returns:
- object itself.
-
getTransferFunction2
Gets the transfer function value orDefault
,TR2
key.- Returns:
-
the returned value is
PdfObject
value, which is either aPdfName
orPdfArray
of a predefined value or an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects).
-
setTransferFunction2
Sets the transfer function value orDefault
,TR2
key. Note, if bothTR
andTR2
are present in the same graphics state parameter dictionary,TR2
takes precedence.- Parameters:
-
transferFunction2
- aPdfObject
, shall be either aPdfName
orPdfArray
of a predefined value or an object representing custom function (seeIPdfFunction
object wrapper for convenience API in reading/manipulating such function objects). - Returns:
- object itself.
-
getHalftone
Gets the halftone dictionary, stream orDefault
,HT
key.- Returns:
-
a
PdfObject
, should be eitherPdfDictionary
,PdfStream
orPdfName
.
-
setHalftone
Sets the halftone orDefault
,HT
key.- Parameters:
-
halftone
- aPdfObject
, shall be eitherPdfDictionary
,PdfStream
orPdfName
. - Returns:
- object itself.
-
getFlatnessTolerance
Gets the flatness tolerance value,FL
key.- Returns:
-
a
float
value if exist, otherwisenull
.
-
setFlatnessTolerance
Sets the flatness tolerance value,FL
key.- Parameters:
-
flatnessTolerance
- afloat
value. - Returns:
- object itself.
-
getSmothnessTolerance
Gets the smoothness tolerance value,SM
key.- Returns:
-
a
float
value if exist, otherwisenull
.
-
setSmoothnessTolerance
Sets the smoothness tolerance value,SM
key.- Parameters:
-
smoothnessTolerance
- afloat
value. - Returns:
- object itself.
-
getAutomaticStrokeAdjustmentFlag
Gets value of an automatic stroke adjustment flag,SA
key.- Returns:
-
a
boolean
value if exist, otherwisenull
.
-
setAutomaticStrokeAdjustmentFlag
Sets value of an automatic stroke adjustment flag,SA
key.- Parameters:
-
strokeAdjustment
- aboolean
value. - Returns:
- object itself.
-
getBlendMode
Gets the current blend mode for the transparent imaging model,BM
key. -
setBlendMode
Sets the current blend mode for the transparent imaging model,BM
key. -
getSoftMask
Gets the current soft mask,SMask
key.- Returns:
-
a
PdfObject
, should be eitherPdfName
orPdfDictionary
.
-
setSoftMask
Sets the current soft mask,SMask
key.- Parameters:
-
sMask
- aPdfObject
, shall be eitherPdfName
orPdfDictionary
. - Returns:
- object itself.
-
getStrokeOpacity
Gets the current alpha constant, specifying the constant shape or constant opacity value for stroking operations in the transparent imaging model,CA
key.- Returns:
-
a
float
value if exist, otherwisenull
.
-
setStrokeOpacity
Sets the current alpha constant, specifying the constant shape or constant opacity value for stroking operations in the transparent imaging model,CA
key.- Parameters:
-
strokingAlphaConstant
- afloat
value. - Returns:
- object itself.
-
getFillOpacity
Gets the current alpha constant, specifying the constant shape or constant opacity value for non-stroking operations in the transparent imaging model,ca
key.- Returns:
-
a
float
value if exist, otherwisenull
.
-
setFillOpacity
Sets the current alpha constant, specifying the constant shape or constant opacity value for non-stroking operations in the transparent imaging model,ca
key.- Parameters:
-
fillingAlphaConstant
- afloat
value. - Returns:
- object itself.
-
getAlphaSourceFlag
Gets the alpha source flag ("alpha is shape"), specifying whether the current soft mask and alpha constant shall be interpreted as shape values (true
) or opacity values (false
),AIS
key.- Returns:
-
a
boolean
value if exist, otherwisenull
.
-
setAlphaSourceFlag
Sets the alpha source flag ("alpha is shape"), specifying whether the current soft mask and alpha constant shall be interpreted as shape values (true
) or opacity values (false
),AIS
key.- Parameters:
-
alphaSourceFlag
- iftrue
- alpha as shape values, iffalse
— as opacity values. - Returns:
- object itself.
-
getTextKnockoutFlag
Gets the text knockout flag, which determine the behaviour of overlapping glyphs within a text object in the transparent imaging model,TK
key.- Returns:
-
a
boolean
value if exist, otherwisenull
.
-
setTextKnockoutFlag
Sets the text knockout flag, which determine the behaviour of overlapping glyphs within a text object in the transparent imaging model,TK
key.- Parameters:
-
textKnockoutFlag
-true
if enabled. - Returns:
- object itself.
-
setUseBlackPointCompensation
PDF 2.0. This graphics state parameter controls whether black point compensation is performed while doing CIE-based colour conversions.- Parameters:
-
useBlackPointCompensation
-true
to enable,false
to disable - Returns:
- object itself
-
isBlackPointCompensationUsed
PDF 2.0. Checks whether the black point compensation is performed while doing CIE-based colour conversions.- Returns:
-
true
if black point compensation is used,false
if it is not used, ornull
is the value is set to Default, or not set at all
-
setHalftoneOrigin
PDF 2.0. Sets halftone origin- Parameters:
-
x
- X location of the halftone origin in the current coordinate system -
y
- Y location of the halftone origin in the current coordinate system - Returns:
-
this
PdfExtGState
instance
-
getHalftoneOrigin
public float[] getHalftoneOrigin()PDF 2.0. Gets halftone origin- Returns:
-
an array of two values specifying X and Y values of the halftone origin in the current coordinate system, respectively, or
null
if halftone origin is not specified
-
put
Puts the value into Graphics state parameter dictionary and associates it with the specified key. If the key is already present, it will override the old value with the specified one.- Parameters:
-
key
- key to insert or to override -
value
- the value to associate with the specified key - Returns:
- object itself.
-
flush
public void flush()To manually flush aPdfObject
behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly callPdfObjectWrapper.makeIndirect(PdfDocument)
. For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.- Overrides:
-
flush
in classPdfObjectWrapper<PdfDictionary>
-
isWrappedObjectMustBeIndirect
protected boolean isWrappedObjectMustBeIndirect()Defines if the object behind this wrapper must be an indirect object in the resultant document.
If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.
Return value of this method shouldn't depend on any logic, it should return always true or false.- Specified by:
-
isWrappedObjectMustBeIndirect
in classPdfObjectWrapper<PdfDictionary>
- Returns:
- true if in the resultant document the object behind the wrapper must be indirect, otherwise false.
-