Class PdfExtGState

java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
com.itextpdf.kernel.pdf.extgstate.PdfExtGState

public class PdfExtGState extends PdfObjectWrapper<PdfDictionary>
Graphics state parameter dictionary wrapper. See ISO-320001, 8.4.5 Graphics State Parameter Dictionaries.
  • Field Details

    • BM_NORMAL

      public static PdfName BM_NORMAL
      Standard separable blend mode. See ISO-320001, table 136
    • BM_MULTIPLY

      public static PdfName BM_MULTIPLY
      Standard separable blend mode. See ISO-320001, table 136
    • BM_SCREEN

      public static PdfName BM_SCREEN
      Standard separable blend mode. See ISO-320001, table 136
    • BM_OVERLAY

      public static PdfName BM_OVERLAY
      Standard separable blend mode. See ISO-320001, table 136
    • BM_DARKEN

      public static PdfName BM_DARKEN
      Standard separable blend mode. See ISO-320001, table 136
    • BM_LIGHTEN

      public static PdfName BM_LIGHTEN
      Standard separable blend mode. See ISO-320001, table 136
    • BM_COLOR_DODGE

      public static PdfName BM_COLOR_DODGE
      Standard separable blend mode. See ISO-320001, table 136
    • BM_COLOR_BURN

      public static PdfName BM_COLOR_BURN
      Standard separable blend mode. See ISO-320001, table 136
    • BM_HARD_LIGHT

      public static PdfName BM_HARD_LIGHT
      Standard separable blend mode. See ISO-320001, table 136
    • BM_SOFT_LIGHT

      public static PdfName BM_SOFT_LIGHT
      Standard separable blend mode. See ISO-320001, table 136
    • BM_DIFFERENCE

      public static PdfName BM_DIFFERENCE
      Standard separable blend mode. See ISO-320001, table 136
    • BM_EXCLUSION

      public static PdfName BM_EXCLUSION
      Standard separable blend mode. See ISO-320001, table 136
    • BM_HUE

      public static PdfName BM_HUE
      Standard nonseparable blend mode. See ISO-320001, table 137
    • BM_SATURATION

      public static PdfName BM_SATURATION
      Standard nonseparable blend mode. See ISO-320001, table 137
    • BM_COLOR

      public static PdfName BM_COLOR
      Standard nonseparable blend mode. See ISO-320001, table 137
    • BM_LUMINOSITY

      public static PdfName BM_LUMINOSITY
      Standard nonseparable blend mode. See ISO-320001, table 137
  • Constructor Details

    • PdfExtGState

      public PdfExtGState (PdfDictionary pdfObject)
      Create instance of graphics state parameter dictionary wrapper by existed PdfDictionary object
      Parameters:
      pdfObject - instance of graphics state parameter dictionary
    • PdfExtGState

      public PdfExtGState()
      Create default instance of graphics state parameter dictionary
  • Method Details

    • getLineWidth

      public Float getLineWidth()
      Gets line width value, LW key.
      Returns:
      a float value if exist, otherwise null.
    • setLineWidth

      public PdfExtGState setLineWidth (float lineWidth)
      Sets line width value, LW key.
      Parameters:
      lineWidth - a float value.
      Returns:
      object itself.
    • getLineCapStyle

      public Integer getLineCapStyle()
      Gets line gap style value, LC key.
      Returns:
      0 - butt cap, 1 - round cap, 2 - projecting square cap.
    • setLineCapStyle

      public PdfExtGState setLineCapStyle (int lineCapStyle)
      Sets line gap style value, LC key.
      Parameters:
      lineCapStyle - 0 - butt cap, 1 - round cap, 2 - projecting square cap.
      Returns:
      object itself.
    • getLineJoinStyle

      public Integer getLineJoinStyle()
      Gets line join style value, LJ key.
      Returns:
      0 - miter join (see also miter limit), 1 - round join, 2 - bevel join.
    • setLineJoinStyle

      public PdfExtGState setLineJoinStyle (int lineJoinStyle)
      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

      public Float getMiterLimit()
      Gets miter limit value, ML key. See also line join style.
      Returns:
      a float value if exist, otherwise null.
    • setMiterLimit

      public PdfExtGState setMiterLimit (float miterLimit)
      Sets miter limit value, ML key. See also line join style.
      Parameters:
      miterLimit - a float value.
      Returns:
      object itself.
    • getDashPattern

      public PdfArray getDashPattern()
      Gets line dash pattern value, D key.
      Returns:
      a PdfArray, that represents line dash pattern.
    • setDashPattern

      public PdfExtGState setDashPattern (PdfArray dashPattern)
      Sets line dash pattern value, D key.
      Parameters:
      dashPattern - a PdfArray, that represents line dash pattern.
      Returns:
      object itself.
    • getRenderingIntent

      public PdfName getRenderingIntent()
      Gets rendering intent value, RI key. Valid values are: AbsoluteColorimetric, RelativeColorimetric, Saturation, Perceptual.
      Returns:
      a PdfName instance.
    • setRenderingIntent

      public PdfExtGState setRenderingIntent (PdfName renderingIntent)
      Sets rendering intent value, RI key.
      Parameters:
      renderingIntent - a PdfName instance, Valid values are: AbsoluteColorimetric, RelativeColorimetric, Saturation, Perceptual.
      Returns:
      object itself.
    • getStrokeOverprintFlag

      public Boolean getStrokeOverprintFlag()
      Get overprint flag value for stroking operations, OP key.
      Returns:
      a boolean value if exist, otherwise null.
    • setStrokeOverPrintFlag

      public PdfExtGState setStrokeOverPrintFlag (boolean strokeOverPrintFlag)
      Set overprint flag value for stroking operations, OP key.
      Parameters:
      strokeOverPrintFlag - true, for applying overprint for stroking operations.
      Returns:
      object itself.
    • getFillOverprintFlag

      public Boolean getFillOverprintFlag()
      Get overprint flag value for non-stroking operations, op key.
      Returns:
      a boolean value if exist, otherwise null.
    • setFillOverPrintFlag

      public PdfExtGState setFillOverPrintFlag (boolean fillOverprintFlag)
      Set overprint flag value for non-stroking operations, op key.
      Parameters:
      fillOverprintFlag - true, for applying overprint for non-stroking operations.
      Returns:
      object itself.
    • getOverprintMode

      public Integer getOverprintMode()
      Get overprint control mode, OPM key.
      Returns:
      an int value if exist, otherwise null.
    • setOverprintMode

      public PdfExtGState setOverprintMode (int overprintMode)
      Set overprint control mode, OPM key.
      Parameters:
      overprintMode - an int value, see ISO-320001, 8.6.7 Overprint Control.
      Returns:
      object itself.
    • getFont

      public PdfArray getFont()
      Gets font and size, Font key.
      Returns:
      a PdfArray of the form [font size], where font shall be an indirect reference to a font dictionary and size shall be a number expressed in text space units.
    • setFont

      public PdfExtGState setFont (PdfArray font)
      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 with PdfDocument.addFont(PdfFont) method first.
      Parameters:
      font - a PdfArray of the form [font size], where font shall be an indirect reference to a font dictionary and size shall be a number expressed in text space units.
      Returns:
      object itself.
    • getBlackGenerationFunction

      public PdfObject getBlackGenerationFunction()
      Gets the black-generation function value, BG.
      Returns:
      a PdfObject, should be an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
    • setBlackGenerationFunction

      public PdfExtGState setBlackGenerationFunction (PdfObject blackGenerationFunction)
      Sets the black-generation function value, BG.
      Parameters:
      blackGenerationFunction - a PdfObject, shall be an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
      Returns:
      object itself.
    • getBlackGenerationFunction2

      public PdfObject getBlackGenerationFunction2()
      Gets the black-generation function value or Default, BG2 key.
      Returns:
      the returned value is PdfObject value, which is either a PdfName of a predefined value or an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
    • setBlackGenerationFunction2

      public PdfExtGState setBlackGenerationFunction2 (PdfObject blackGenerationFunction2)
      Sets the black-generation function value or Default, BG2 key. Note, if both BG and BG2 are present in the same graphics state parameter dictionary, BG2 takes precedence.
      Parameters:
      blackGenerationFunction2 - a PdfObject value, shall be an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects) or Default.
      Returns:
      object itself.
    • getUndercolorRemovalFunction

      public PdfObject getUndercolorRemovalFunction()
      Gets the undercolor-removal function, UCR key.
      Returns:
      a PdfObject, should be an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
    • setUndercolorRemovalFunction

      public PdfExtGState setUndercolorRemovalFunction (PdfObject undercolorRemovalFunction)
      Sets the undercolor-removal function, UCR key.
      Parameters:
      undercolorRemovalFunction - a PdfObject, shall be an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
      Returns:
      object itself.
    • getUndercolorRemovalFunction2

      public PdfObject getUndercolorRemovalFunction2()
      Gets the undercolor-removal function value or Default, UCR2 key.
      Returns:
      the returned value is PdfObject value, which is either a PdfName of a predefined value or an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
    • setUndercolorRemovalFunction2

      public PdfExtGState setUndercolorRemovalFunction2 (PdfObject undercolorRemovalFunction2)
      Sets the undercolor-removal function value or Default, UCR2 key. Note, if both UCR and UCR2 are present in the same graphics state parameter dictionary, UCR2 takes precedence.
      Parameters:
      undercolorRemovalFunction2 - a PdfObject value, shall be an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects) or Default.
      Returns:
      object itself.
    • getTransferFunction

      public PdfObject getTransferFunction()
      Gets the transfer function value, TR key.
      Returns:
      the returned value is PdfObject value, which is either a PdfName or PdfArray of a predefined value or an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
    • setTransferFunction

      public PdfExtGState setTransferFunction (PdfObject transferFunction)
      Sets the transfer function value, TR key.
      Parameters:
      transferFunction - a PdfObject, shall be either a PdfName or PdfArray of a predefined value or an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
      Returns:
      object itself.
    • getTransferFunction2

      public PdfObject getTransferFunction2()
      Gets the transfer function value or Default, TR2 key.
      Returns:
      the returned value is PdfObject value, which is either a PdfName or PdfArray of a predefined value or an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
    • setTransferFunction2

      public PdfExtGState setTransferFunction2 (PdfObject transferFunction2)
      Sets the transfer function value or Default, TR2 key. Note, if both TR and TR2 are present in the same graphics state parameter dictionary, TR2 takes precedence.
      Parameters:
      transferFunction2 - a PdfObject, shall be either a PdfName or PdfArray of a predefined value or an object representing custom function (see IPdfFunction object wrapper for convenience API in reading/manipulating such function objects).
      Returns:
      object itself.
    • getHalftone

      public PdfObject getHalftone()
      Gets the halftone dictionary, stream or Default, HT key.
      Returns:
      a PdfObject, should be either PdfDictionary, PdfStream or PdfName.
    • setHalftone

      public PdfExtGState setHalftone (PdfObject halftone)
      Sets the halftone or Default, HT key.
      Parameters:
      halftone - a PdfObject, shall be either PdfDictionary, PdfStream or PdfName.
      Returns:
      object itself.
    • getFlatnessTolerance

      public Float getFlatnessTolerance()
      Gets the flatness tolerance value, FL key.
      Returns:
      a float value if exist, otherwise null.
    • setFlatnessTolerance

      public PdfExtGState setFlatnessTolerance (float flatnessTolerance)
      Sets the flatness tolerance value, FL key.
      Parameters:
      flatnessTolerance - a float value.
      Returns:
      object itself.
    • getSmothnessTolerance

      public Float getSmothnessTolerance()
      Gets the smoothness tolerance value, SM key.
      Returns:
      a float value if exist, otherwise null.
    • setSmoothnessTolerance

      public PdfExtGState setSmoothnessTolerance (float smoothnessTolerance)
      Sets the smoothness tolerance value, SM key.
      Parameters:
      smoothnessTolerance - a float value.
      Returns:
      object itself.
    • getAutomaticStrokeAdjustmentFlag

      public Boolean getAutomaticStrokeAdjustmentFlag()
      Gets value of an automatic stroke adjustment flag, SA key.
      Returns:
      a boolean value if exist, otherwise null.
    • setAutomaticStrokeAdjustmentFlag

      public PdfExtGState setAutomaticStrokeAdjustmentFlag (boolean strokeAdjustment)
      Sets value of an automatic stroke adjustment flag, SA key.
      Parameters:
      strokeAdjustment - a boolean value.
      Returns:
      object itself.
    • getBlendMode

      public PdfObject getBlendMode()
      Gets the current blend mode for the transparent imaging model, BM key.
      Returns:
      a PdfObject, should be either PdfName or PdfArray. array is deprecated in PDF 2.0.
    • setBlendMode

      public PdfExtGState setBlendMode (PdfObject blendMode)
      Sets the current blend mode for the transparent imaging model, BM key.
      Parameters:
      blendMode - a PdfObject, shall be either PdfName or PdfArray; array is deprecated in PDF 2.0.
      Returns:
      object itself.
    • getSoftMask

      public PdfObject getSoftMask()
      Gets the current soft mask, SMask key.
      Returns:
      a PdfObject, should be either PdfName or PdfDictionary.
    • setSoftMask

      public PdfExtGState setSoftMask (PdfObject sMask)
      Sets the current soft mask, SMask key.
      Parameters:
      sMask - a PdfObject, shall be either PdfName or PdfDictionary.
      Returns:
      object itself.
    • getStrokeOpacity

      public Float 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, otherwise null.
    • setStrokeOpacity

      public PdfExtGState 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.
      Parameters:
      strokingAlphaConstant - a float value.
      Returns:
      object itself.
    • getFillOpacity

      public Float 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, otherwise null.
    • setFillOpacity

      public PdfExtGState 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.
      Parameters:
      fillingAlphaConstant - a float value.
      Returns:
      object itself.
    • getAlphaSourceFlag

      public Boolean 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, otherwise null.
    • setAlphaSourceFlag

      public PdfExtGState 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.
      Parameters:
      alphaSourceFlag - if true - alpha as shape values, if false — as opacity values.
      Returns:
      object itself.
    • getTextKnockoutFlag

      public Boolean 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, otherwise null.
    • setTextKnockoutFlag

      public PdfExtGState 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.
      Parameters:
      textKnockoutFlag - true if enabled.
      Returns:
      object itself.
    • setUseBlackPointCompensation

      public PdfExtGState setUseBlackPointCompensation (boolean useBlackPointCompensation)
      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

      public Boolean 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, or null is the value is set to Default, or not set at all
    • setHalftoneOrigin

      public PdfExtGState setHalftoneOrigin (float x, float y)
      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

      public PdfExtGState put (PdfName key, PdfObject value)
      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 a PdfObject 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 call PdfObjectWrapper.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 class PdfObjectWrapper<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 class PdfObjectWrapper<PdfDictionary>
      Returns:
      true if in the resultant document the object behind the wrapper must be indirect, otherwise false.