Package com.evopdf

# Class Template

java.lang.Object
com.evopdf.ElementsRenderer
com.evopdf.Template

public class Template extends ElementsRenderer
Represents a template element which can be repeated in all PDF document pages. You can use variables like current PDF page number and the total number of PDF pages in a template

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addElement(PageElement pageElement)`
  Adds a PDF page element to this template repeated in each PDF page
  `TemplateAnchoring`
  `anchoring()`
  Gets the template anchoring inside the PDF page
  `boolean`
  `bringToFront()`
  Gets the flag indicating if the the template is rendered in front of the page main content
  `TemplateDocking`
  `docking()`
  Gets the the template docking inside the PDF page
  `boolean`
  `drawOnEvenPages()`
  Gets the flag indicating if the template is drawn on the even pages
  `boolean`
  `drawOnFirstPage()`
  Gets the flag indicating if the template is drawn on the first page
  `boolean`
  `drawOnOddPages()`
  Gets the flag indicating if the template is drawn on the odd pages
  `float`
  `height()`
  Gets template height for a custom template
  `boolean`
  `isFooter()`
  Gets a flag indicating if this template was created as document footer
  `boolean`
  `isHeader()`
  Gets a flag indicating if this template was created as document header
  `int`
  `pageNumberingPageCountIncrement()`
  Gets the increment for the total number of pages displayed using &P; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
  `int`
  `pageNumberingStartIndex()`
  Gets the start index for page numbering using the &p; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
  `boolean`
  `sendToBackground()`
  Gets the flag indicating if the the template is rendered in the back of the page main content
  `void`
  `setAnchoring(TemplateAnchoring anchoring)`
  Sets the template anchoring inside the PDF page
  `void`
  `setBringToFront(boolean bringToFront)`
  Sets the flag indicating if the the template is rendered in front of the page main content.
  `void`
  `setDocking(TemplateDocking docking)`
  Sets the template docking inside the PDF page
  `void`
  `setDrawOnEvenPages(boolean drawOnEvenPages)`
  Sets the flag indicating if the template is drawn on the even pages
  `void`
  `setDrawOnEvePages(boolean drawOnFirstPage)`
  Sets the flag indicating if the template is drawn on the first page
  `void`
  `setDrawOnOddPages(boolean drawOnOddPages)`
  Sets the flag indicating if the template is drawn on the odd pages
  `void`
  `setPageNumberingPageCountIncrement(int pageNumberingPageCountIncrement)`
  Sets the increment for the total number of pages displayed using &P; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
  `void`
  `setPageNumberingStartIndex(int pageNumberingStartIndex)`
  Sets the start index for page numbering using the &p; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
  `void`
  `setSendToBackground(boolean sendToBackground)`
  Sets the flag indicating if the the template is rendered in the back of the page main content
  `float`
  `width()`
  Gets the template width for a custom template
  `float`
  `x()`
  Gets template X location for a custom template
  `float`
  `y()`
  Gets template Y location for a custom template

  ### Methods inherited from class com.evopdf.ElementsRenderer

  `parentDocument, setParentDocument`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### width

    public float width()
    Gets the template width for a custom template
    Returns:
      the template width

  - ### height

    public float height()
    Gets template height for a custom template
    Returns:
      the template height

  - ### x

    public float x()
    Gets template X location for a custom template
    Returns:
      the template X location

  - ### y

    public float y()
    Gets template Y location for a custom template
    Returns:
      the template Y location

  - ### isHeader

    public boolean isHeader()
    Gets a flag indicating if this template was created as document header
    Returns:
      the flag indicating if this template was created as document header

  - ### isFooter

    public boolean isFooter()
    Gets a flag indicating if this template was created as document footer
    Returns:
      the flag indicating if this template was created as document footer

  - ### docking

    public TemplateDocking docking()
    Gets the the template docking inside the PDF page
    Returns:
      the template docking inside the PDF page

  - ### setDocking

    public void setDocking(TemplateDocking docking)
    Sets the template docking inside the PDF page
    Parameters:
      `docking` - the template docking to set

  - ### anchoring

    public TemplateAnchoring anchoring()
    Gets the template anchoring inside the PDF page
    Returns:
      the template anchoring inside the PDF page

  - ### setAnchoring

    public void setAnchoring(TemplateAnchoring anchoring)
    Sets the template anchoring inside the PDF page
    Parameters:
      `anchoring` - the template anchoring to set

  - ### drawOnOddPages

    public boolean drawOnOddPages()
    Gets the flag indicating if the template is drawn on the odd pages
    Returns:
      the flag value

  - ### setDrawOnOddPages

    public void setDrawOnOddPages(boolean drawOnOddPages)
    Sets the flag indicating if the template is drawn on the odd pages
    Parameters:
      `drawOnOddPages` - the flag value to set

  - ### drawOnEvenPages

    public boolean drawOnEvenPages()
    Gets the flag indicating if the template is drawn on the even pages
    Returns:
      the flag value

  - ### setDrawOnEvenPages

    public void setDrawOnEvenPages(boolean drawOnEvenPages)
    Sets the flag indicating if the template is drawn on the even pages
    Parameters:
      `drawOnEvenPages` - the flag value to set

  - ### drawOnFirstPage

    public boolean drawOnFirstPage()
    Gets the flag indicating if the template is drawn on the first page
    Returns:
      the flag value

  - ### setDrawOnEvePages

    public void setDrawOnEvePages(boolean drawOnFirstPage)
    Sets the flag indicating if the template is drawn on the first page
    Parameters:
      `drawOnFirstPage` - the flag value to set

  - ### pageNumberingStartIndex

    public int pageNumberingStartIndex()
    Gets the start index for page numbering using the &p; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
    Returns:
      the current start index

  - ### setPageNumberingStartIndex

    public void setPageNumberingStartIndex(int pageNumberingStartIndex)
    Sets the start index for page numbering using the &p; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
    Parameters:
      `pageNumberingStartIndex` - the start index to set

  - ### pageNumberingPageCountIncrement

    public int pageNumberingPageCountIncrement()
    Gets the increment for the total number of pages displayed using &P; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
    Returns:
      the current increment

  - ### setPageNumberingPageCountIncrement

    public void setPageNumberingPageCountIncrement(int pageNumberingPageCountIncrement)
    Sets the increment for the total number of pages displayed using &P; variable in a `TextElement` or `HtmlToPdfVariableElement` added to the template
    Parameters:
      `pageNumberingPageCountIncrement` - the increment to set

  - ### bringToFront

    public boolean bringToFront()
    Gets the flag indicating if the the template is rendered in front of the page main content
    Returns:
      the flag value

  - ### setBringToFront

    public void setBringToFront(boolean bringToFront)
    Sets the flag indicating if the the template is rendered in front of the page main content. By default this property is true
    Parameters:
      `bringToFront` - the flag value to set

  - ### sendToBackground

    public boolean sendToBackground()
    Gets the flag indicating if the the template is rendered in the back of the page main content
    Returns:
      the flag value

  - ### setSendToBackground

    public void setSendToBackground(boolean sendToBackground)
    Sets the flag indicating if the the template is rendered in the back of the page main content
    Parameters:
      `sendToBackground` - the flag value to set

  - ### addElement

    public void addElement(PageElement pageElement)
    Adds a PDF page element to this template repeated in each PDF page
    Specified by:
      `addElement` in class `ElementsRenderer`
    Parameters:
      `pageElement` - the page element to add to template