Class DocumentRenderer

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void decreaseCursorY​(float offset)
      Decrease (move down) the current cursor y position by the given offset.
      org.apache.pdfbox.pdmodel.PDPageContentStream getCS()
      Returns the content stream of current page.
      float getCursorY()
      Returns the current cursor y position.
      PDFFont getFont()
      Returns the PDFFont used to render text.
      org.apache.pdfbox.pdmodel.common.PDRectangle getRect()
      Returns the rectangle of the current page.
      DocumentRenderer getRootRenderer()
      Returns the root renderer.
      void handleExceedY()
      Handle the case that the current cursor y position is exceed the rectangle of the current page.
      boolean isExceedY​(float offset)
      Returns whether the current cursor y position with the given offset is exceed the rectangle of the current page.
      void render()
      Render the DocumentNode.
      void save​(java.io.OutputStream os)
      Save the PDF to the specified output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DocumentRenderer

        public DocumentRenderer​(PDFDocument pdfDocument)
        Create a new renderer for the specified PDFDocument.
        Parameters:
        pdfDocument - the PDFDocument
    • Method Detail

      • save

        public void save​(java.io.OutputStream os)
                  throws java.io.IOException
        Save the PDF to the specified output stream.
        Parameters:
        os - the output stream
        Throws:
        java.io.IOException - if an I/O error occurs
      • render

        public void render()
                    throws java.io.IOException
        Description copied from interface: IRenderer
        Render the DocumentNode.
        Specified by:
        render in interface IRenderer
        Throws:
        java.io.IOException
      • getCS

        public org.apache.pdfbox.pdmodel.PDPageContentStream getCS()
        Description copied from interface: IRenderer
        Returns the content stream of current page.
        Specified by:
        getCS in interface IRenderer
        Returns:
        the content stream of current page
      • getRect

        public org.apache.pdfbox.pdmodel.common.PDRectangle getRect()
        Description copied from interface: IContainerRenderer
        Returns the rectangle of the current page.
        Specified by:
        getRect in interface IContainerRenderer
        Returns:
        the rectangle of the current page.
      • getCursorY

        public float getCursorY()
        Description copied from interface: IContainerRenderer
        Returns the current cursor y position.
        Specified by:
        getCursorY in interface IContainerRenderer
        Returns:
        the current cursor y position.
      • decreaseCursorY

        public void decreaseCursorY​(float offset)
        Description copied from interface: IContainerRenderer
        Decrease (move down) the current cursor y position by the given offset.
        Specified by:
        decreaseCursorY in interface IContainerRenderer
        Parameters:
        offset - the y offset to decrease.
      • isExceedY

        public boolean isExceedY​(float offset)
        Description copied from interface: IContainerRenderer
        Returns whether the current cursor y position with the given offset is exceed the rectangle of the current page.
        Specified by:
        isExceedY in interface IContainerRenderer
        Parameters:
        offset - the y offset to check.
        Returns:
        whether exceed the rectangle of the current page.
      • handleExceedY

        public void handleExceedY()
                           throws java.io.IOException
        Description copied from interface: IContainerRenderer
        Handle the case that the current cursor y position is exceed the rectangle of the current page.
        Specified by:
        handleExceedY in interface IContainerRenderer
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getFont

        public PDFFont getFont()
        Returns the PDFFont used to render text.
        Returns:
        the PDFFont of this document renderer.