Class PdfPattern

java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
com.itextpdf.kernel.pdf.colorspace.PdfPattern
Direct Known Subclasses:
PdfPattern.Shading, PdfPattern.Tiling

public abstract class PdfPattern extends PdfObjectWrapper<PdfDictionary>
Dictionary wrapper that represent special type of color space, that uses pattern objects as the equivalent of colour values instead of the numeric component values used with other spaces. A pattern object shall be a dictionary or a stream, depending on the type of pattern. For mor information see paragraph 8.7 in ISO-32000-1.
  • Constructor Details

  • Method Details

    • getPatternInstance

      public static PdfPattern getPatternInstance (PdfDictionary pdfObject)
      Creates the instance wrapper of correct type from the PdfDictionary
      Parameters:
      pdfObject - the PdfDictionary that represent Pattern
      Returns:
      new wrapper instance.
    • getMatrix

      public PdfArray getMatrix()
      Gets a transformation matrix that maps the pattern’s internal coordinate system to the default coordinate system of the pattern’s parent content stream. The concatenation of the pattern matrix with that of the parent content stream establishes the pattern coordinate space, within which all graphics objects in the pattern shall be interpreted.
      Returns:
      pattern matrix
    • setMatrix

      public void setMatrix (PdfArray matrix)
      Sets a transformation matrix that maps the pattern’s internal coordinate system to the default coordinate system of the pattern’s parent content stream. The concatenation of the pattern matrix with that of the parent content stream establishes the pattern coordinate space, within which all graphics objects in the pattern shall be interpreted.
      Parameters:
      matrix - pattern matrix to set
    • 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()
      Description copied from class: PdfObjectWrapper
      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.