Class Text

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, Serializable

    public class Text
    extends AbstractPageRangeStamper
    Simple text stamper.
    You can use placeholders for the page index:
    - 0-based: #
    - 1-based: @
    Variables in the template get expanded as well.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -pages <adams.core.Range> (property: pages)
        The pages to stamp.
        default: first-last
        example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; the following placeholders can be used as well: first, second, third, last_2, last_1, last
     
    -template <java.lang.String> (property: template)
        The text template to use for the stamp.
        default: Page @
     
    -alignment <LEFT|CENTER|RIGHT> (property: alignment)
        The alignment of the text.
        default: CENTER
     
    -font <adams.core.io.PdfFont> (property: font)
        The font to use for the text.
        default: Helvetica-Normal-12
     
    -x <float> (property: X)
        The X position.
        default: 0.0
        minimum: 0.0
     
    -y <float> (property: Y)
        The Y position.
        default: 0.0
        minimum: 0.0
     
    -rotation <float> (property: rotation)
        The rotation in degrees, counterclockwise.
        default: 0.0
        minimum: 0.0
        maximum: 360.0
     
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • PLACEHOLDER_0PAGE

        public static final String PLACEHOLDER_0PAGE
        the placeholder for the 0-based page index.
        See Also:
        Constant Field Values
      • PLACEHOLDER_1PAGE

        public static final String PLACEHOLDER_1PAGE
        the placeholder for the 1-based page index.
        See Also:
        Constant Field Values
      • m_Template

        protected String m_Template
        the text template.
      • m_Font

        protected PdfFont m_Font
        the font.
      • m_X

        protected float m_X
        the x position.
      • m_Y

        protected float m_Y
        the y position.
      • m_Rotation

        protected float m_Rotation
        the rotation.
    • Constructor Detail

      • Text

        public Text()
    • Method Detail

      • setTemplate

        public void setTemplate​(String value)
        Sets the text template.
        Parameters:
        value - the template
      • getTemplate

        public String getTemplate()
        Returns the text template.
        Returns:
        the template
      • templateTipText

        public String templateTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setAlignment

        public void setAlignment​(Text.Alignment value)
        Sets the alignment for the text.
        Parameters:
        value - the alignment
      • getAlignment

        public Text.Alignment getAlignment()
        Returns the alignment for the text.
        Returns:
        the alignment
      • alignmentTipText

        public String alignmentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFont

        public void setFont​(PdfFont value)
        Sets the font to use.
        Parameters:
        value - the font
      • getFont

        public PdfFont getFont()
        Returns the font in use.
        Returns:
        the font
      • fontTipText

        public String fontTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setX

        public void setX​(float value)
        Sets the X position for the text.
        Parameters:
        value - the x position
      • getX

        public float getX()
        Returns the X position for the text.
        Returns:
        the x position
      • XTipText

        public String XTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setY

        public void setY​(float value)
        Sets the Y position for the text.
        Parameters:
        value - the y position
      • getY

        public float getY()
        Returns the Y position for the text.
        Returns:
        the y position
      • YTipText

        public String YTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setRotation

        public void setRotation​(float value)
        Sets the rotation for the text.
        Parameters:
        value - the rotation (degrees counterclockwise)
      • getRotation

        public float getRotation()
        Returns the rotation for the text.
        Returns:
        the rotation (degrees counterclockwise)
      • rotationTipText

        public String rotationTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doStamp

        protected void doStamp​(com.itextpdf.text.pdf.PdfStamper stamper,
                               int page)
        Performs the actual stamping.
        Specified by:
        doStamp in class AbstractPageRangeStamper
        Parameters:
        stamper - the stamper to use
        page - the page to apply the stamp to