Class 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 Detail

      • 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 Detail

      • 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