Interface PDFTarget

  • All Superinterfaces:
    RenderTarget

    public interface PDFTarget
    extends RenderTarget
    Rendering target to PDF format.

    This target is used by renderers objects to render a graph to PDF and uses the PDFBox Java library.

    The target give access to the PDPageContentStream object from PDFBox to draw items.

    When this target is instantiated it uses property values defined in the PreviewProperties. Namely is uses MARGIN_LEFT, MARGIN_TOP, MARGIN_BOTTOM, MARGIN_RIGHT, LANDSCAPE and PAGESIZE.

    Author:
    Yudi Xue, Mathieu Bastian
    • Method Detail

      • getContentStream

        org.apache.pdfbox.pdmodel.PDPageContentStream getContentStream()
        Returns the PDPageContentStream instance of the PDFTarget. PDPageContentStream offers a set of drawing functions which can be used by Renderer objects.
        Returns:
        a PDPageContentStream object
      • getPDFont

        org.apache.pdfbox.pdmodel.font.PDFont getPDFont​(Font font)
        Get the PDFBox equivalent the Java font.

        If font can't be found it returns the default Helvetica font.

        Note that each font (regardless of font size) is embedded in the PDF Document. Also note that some fonts might miss Unicode characters, which will prevent the text from being rendered properly.

        Parameters:
        font - the reference Java font
        Returns:
        the PDFont, or Helvetica is not found
      • getMarginBottom

        float getMarginBottom()
        Returns the margin at the bottom of the page.
        Returns:
        the bottom margin, in pixels
      • getMarginLeft

        float getMarginLeft()
        Returns the margin at the left of the page.
        Returns:
        the left margin, in pixels
      • getMarginRight

        float getMarginRight()
        Returns the margin at the right of the page.
        Returns:
        the right margin, in pixels
      • getMarginTop

        float getMarginTop()
        Returns the margin at the top of the page.
        Returns:
        the top margin, in pixels
      • isLandscape

        boolean isLandscape()
        Returns whether the orientation is in landscape or portrait.
        Returns:
        true if the orientation is landscape, false if portrait.
      • getPageSize

        org.apache.pdfbox.pdmodel.common.PDRectangle getPageSize()
        Returns the page's size.
        Returns:
        the page size