Class DrawingUtil


  • public class DrawingUtil
    extends java.lang.Object
    Internal Use Only.

    Utility class for drawing shapes in a PDF document.

    This class provides methods to draw shapes, lines, circle, etc.

    Author:
    jamson
    • Constructor Summary

      Constructors 
      Constructor Description
      DrawingUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void drawCircle​(org.apache.pdfbox.pdmodel.PDPageContentStream cs, float x, float y, float r, java.awt.Color c)
      Draw a circle.
      static void drawDashedLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs, float x1, float y1, float x2, float y2, float w, java.awt.Color c)
      Draw a dashed line.
      static void drawDottedLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs, float x1, float y1, float x2, float y2, float w, java.awt.Color c)
      Draw a dotted line.
      static void drawDoubleLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs, float x1, float y1, float x2, float y2, float w, java.awt.Color c)
      Draw a double line.
      static void drawLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs, float x1, float y1, float x2, float y2, float w, java.awt.Color c)
      Draw a line.
      static void drawNotDef​(org.apache.pdfbox.pdmodel.PDPageContentStream cs, float x, float y, float w)
      Draw a not-defined figure, this method should ONLY invoke while drawing a text.
      static void drawRect​(org.apache.pdfbox.pdmodel.PDPageContentStream cs, float x, float y, float w, float h, java.awt.Color c)
      Draw a rectangle.
      • Methods inherited from class java.lang.Object

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

      • DrawingUtil

        public DrawingUtil()
    • Method Detail

      • drawRect

        public static void drawRect​(org.apache.pdfbox.pdmodel.PDPageContentStream cs,
                                    float x,
                                    float y,
                                    float w,
                                    float h,
                                    java.awt.Color c)
                             throws java.io.IOException
        Draw a rectangle.
        Parameters:
        cs - the content stream
        x - the x coordinate of the top-left corner
        y - the y coordinate of the top-left corner
        w - the width of the rectangle
        h - the height of the rectangle
        c - the color of the rectangle
        Throws:
        java.io.IOException - if an I/O error occurs
      • drawCircle

        public static void drawCircle​(org.apache.pdfbox.pdmodel.PDPageContentStream cs,
                                      float x,
                                      float y,
                                      float r,
                                      java.awt.Color c)
                               throws java.io.IOException
        Draw a circle.
        Parameters:
        cs - the content stream
        x - the x coordinate of the center
        y - the y coordinate of the center
        r - the radius of the circle
        c - the color of the circle
        Throws:
        java.io.IOException - if an I/O error occurs
      • drawLine

        public static void drawLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs,
                                    float x1,
                                    float y1,
                                    float x2,
                                    float y2,
                                    float w,
                                    java.awt.Color c)
                             throws java.io.IOException
        Draw a line.
        Parameters:
        cs - the content stream
        x1 - the start x coordinate
        y1 - the start y coordinate
        x2 - the end x coordinate
        y2 - the end y coordinate
        w - the width of the border
        c - the color of the border
        Throws:
        java.io.IOException - if an I/O error occurs
      • drawDoubleLine

        public static void drawDoubleLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs,
                                          float x1,
                                          float y1,
                                          float x2,
                                          float y2,
                                          float w,
                                          java.awt.Color c)
                                   throws java.io.IOException
        Draw a double line.
        Parameters:
        cs - the content stream
        x1 - the start x coordinate
        y1 - the start y coordinate
        x2 - the end x coordinate
        y2 - the end y coordinate
        w - the width of the border
        c - the color of the border
        Throws:
        java.io.IOException - if an I/O error occurs
      • drawDashedLine

        public static void drawDashedLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs,
                                          float x1,
                                          float y1,
                                          float x2,
                                          float y2,
                                          float w,
                                          java.awt.Color c)
                                   throws java.io.IOException
        Draw a dashed line.
        Parameters:
        cs - the content stream
        x1 - the start x coordinate
        y1 - the start y coordinate
        x2 - the end x coordinate
        y2 - the end y coordinate
        w - the width of the border
        c - the color of the border
        Throws:
        java.io.IOException - if an I/O error occurs
      • drawDottedLine

        public static void drawDottedLine​(org.apache.pdfbox.pdmodel.PDPageContentStream cs,
                                          float x1,
                                          float y1,
                                          float x2,
                                          float y2,
                                          float w,
                                          java.awt.Color c)
                                   throws java.io.IOException
        Draw a dotted line.
        Parameters:
        cs - the content stream
        x1 - the start x coordinate
        y1 - the start y coordinate
        x2 - the end x coordinate
        y2 - the end y coordinate
        w - the width of the border
        c - the color of the border
        Throws:
        java.io.IOException - if an I/O error occurs
      • drawNotDef

        public static void drawNotDef​(org.apache.pdfbox.pdmodel.PDPageContentStream cs,
                                      float x,
                                      float y,
                                      float w)
                               throws java.io.IOException
        Draw a not-defined figure, this method should ONLY invoke while drawing a text.
        Parameters:
        cs - the content stream
        x - the x coordinate
        y - the y coordinate
        w - the width
        Throws:
        java.io.IOException - if an I/O error occurs