Class PageRenderContext

java.lang.Object
com.helger.pdflayout.render.PageRenderContext

@NotThreadSafe public final class PageRenderContext extends Object
This class contains the context for rendering a single element onto the PDF.
Author:
Philip Helger
  • Constructor Details

    • PageRenderContext

      public PageRenderContext(@Nonnull PageRenderContext aCtx, float fStartLeft, float fStartTop, float fWidth, float fHeight)
      Parameters:
      aCtx - Context to copy settings from. May not be null.
      fStartLeft - Absolute page x-start position of the element. Does not contain margin, padding or border of the element to be rendered.
      fStartTop - Absolute page y-start position of the element. Does not contain margin, padding or border of the element to be rendered.
      fWidth - available width determined from the surrounding element
      fHeight - available height determined from the surrounding element
    • PageRenderContext

      public PageRenderContext(@Nonnull ERenderingElementType eElementType, @Nonnull PDPageContentStreamWithCache aCS, float fStartLeft, float fStartTop, float fWidth, float fHeight)
      Parameters:
      eElementType - Element type. May not be null.
      aCS - Page content stream. May not be null.
      fStartLeft - Absolute page x-start position of the element. Does not contain margin, padding or border of the element to be rendered.
      fStartTop - Absolute page y-start position of the element. Does not contain margin, padding or border of the element to be rendered.
      fWidth - available width determined from the surrounding element
      fHeight - available height determined from the surrounding element
  • Method Details

    • getElementType

      @Nonnull public ERenderingElementType getElementType()
      Returns:
      The type of the element currently rendered. Never null .
    • getContentStream

      @Nonnull public PDPageContentStreamWithCache getContentStream()
      Returns:
      The current content stream to write to. Never null.
    • getDocument

      @Nonnull public org.apache.pdfbox.pdmodel.PDDocument getDocument()
      Returns:
      The underlying PDF document. Never null.
    • getStartLeft

      public float getStartLeft()
      Returns:
      Absolute page x-start position. Does not contain margin, padding or border of the element to be rendered.
    • getStartTop

      public float getStartTop()
      Returns:
      Absolute page y-start position. Does not contain margin, padding or border of the element to be rendered.
    • getWidth

      public float getWidth()
      Returns:
      available width determined from the surrounding element
    • getHeight

      public float getHeight()
      Returns:
      available height determined from the surrounding element
    • toString

      public String toString()
      Overrides:
      toString in class Object