Class Page

java.lang.Object
net.atthegate.server.service.pdf.Page

public class Page extends Object
Used to create PDF page objects. Please note:
  The coordinate (0f, 0f) is the top left corner of the page.
  The size of the pages are represented in points.
  1 point is 1/72 inches.
  
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<net.atthegate.server.service.pdf.Annotation>
     
    protected float[]
     
    protected float[]
     
     
    protected List<Integer>
     
    protected float[]
     
    protected List<Destination>
     
    protected float
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    protected int
     
    protected PDFobj
     
    protected PDF
     
    protected int
     
    protected float
     
    protected List<StructElem>
     
    protected float[]
     
    protected float[]
     
    protected float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Page(PDF pdf, float[] pageSize)
    Creates page object and add it to the PDF document.
    Page(PDF pdf, float[] pageSize, boolean addPageToPDF)
    Creates page object and add it to the PDF document.
    Page(PDF pdf, PDFobj pageObj)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addAnnotation(net.atthegate.server.service.pdf.Annotation annotation)
     
    void
    addBMC(String structure, String altDescription, String actualText)
     
    void
    addBMC(String structure, String language, String altDescription, String actualText)
     
    addDestination(String name, float yPosition)
    Adds destination to this page.
    void
     
    addResource(CoreFont coreFont, Map<Integer,PDFobj> objects)
     
    void
    addResource(Font font, Map<Integer,PDFobj> objects)
     
    void
    addResource(Image image, Map<Integer,PDFobj> objects)
     
    void
    addWatermark(Font font, String text)
     
    protected void
    append(byte b)
     
    void
    append(byte[] buffer)
    Appends the specified array of bytes to the page.
    protected void
    append(char ch)
     
    protected void
    append(float val)
     
    protected void
    append(int num)
     
    protected void
     
    protected void
    beginTransform(float x, float y, float xScale, float yScale)
     
    void
    Draws a bezier curve starting from the current point.
    void
    Clips the path.
    void
    clipRect(float x, float y, float w, float h)
     
    void
    Closes the path and draws it using the current pen color.
    void
     
    void
    drawCircle(double x, double y, double r)
    Draws a circle on the page.
    void
    drawCircle(double x, double y, double r, char operation)
    Draws the specified circle on the page and fills it with the current brush color.
    void
    drawCircle(float x, float y, float r)
    Draws a circle on the page.
    void
    drawCircle(float x, float y, float r, char operation)
    Draws the specified circle on the page and fills it with the current brush color.
    void
    drawContents(byte[] content, float h, float x, float y, float xScale, float yScale)
     
    void
    drawEllipse(double x, double y, double r1, double r2)
    Draws an ellipse on the page using the current pen color.
    void
    drawEllipse(float x, float y, float r1, float r2)
    Draws an ellipse on the page using the current pen color.
    void
    drawLine(double x1, double y1, double x2, double y2)
    Draws a line on the page, using the current color, between the points (x1, y1) and (x2, y2).
    void
    drawLine(float x1, float y1, float x2, float y2)
    Draws a line on the page, using the current color, between the points (x1, y1) and (x2, y2).
    void
    drawPath(List<Point> path, char operation)
    Draws or fills the specified path using the current pen or brush.
    void
    Draws a point on the page using the current pen color.
    void
    drawRect(double x, double y, double w, double h)
    Draws the outline of the specified rectangle on the page.
    void
    drawRect(float x, float y, float w, float h)
    Draws the outline of the specified rectangle on the page.
    void
    drawRectRoundCorners(float x, float y, float w, float h, float r1, float r2, char operation)
     
    void
    drawString(Font font, String str, double x, double y)
    Draws the text given by the specified string, using the specified font and the current brush color.
    void
    drawString(Font font, String str, float x, float y)
    Draws the text given by the specified string, using the specified font and the current brush color.
    void
    drawString(Font font, String str, float x, float y, float dx)
     
    protected void
    drawString(Font font, String str, float x, float y, Map<String,Integer> colors)
     
    void
    drawString(Font font1, Font font2, String str, float x, float y)
    Draws the text given by the specified string, using the specified main font and the current brush color.
    protected void
     
    void
    fillEllipse(double x, double y, double r1, double r2)
    Fills an ellipse on the page using the current pen color.
    void
    fillEllipse(float x, float y, float r1, float r2)
    Fills an ellipse on the page using the current pen color.
    void
    Closes and fills the path with the current brush color.
    void
    fillRect(double x, double y, double w, double h)
    Fills the specified rectangle on the page.
    void
    fillRect(float x, float y, float w, float h)
    Fills the specified rectangle on the page.
    float[]
    Returns the brush color.
    byte[]
     
    float
    Returns the height of this page.
    float
    Returns the width of this page.
    void
     
    void
    lineTo(double x, double y)
    Draws a line from the current pen position to the point with coordinates (x, y), using the current pen width and stroke color.
    void
    lineTo(float x, float y)
    Draws a line from the current pen position to the point with coordinates (x, y), using the current pen width and stroke color.
    void
    moveTo(double x, double y)
    Moves the pen to the point with coordinates (x, y) on the page.
    void
    moveTo(float x, float y)
    Moves the pen to the point with coordinates (x, y) on the page.
    void
    Prints a line of text.
    void
    Move to the next line.
    void
    Prints a line of text and moves to the next line.
    void
     
    void
     
    void
    setArtBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
    Sets the page ArtBox.
    void
    setBleedBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
    Sets the page BleedBox.
    void
    setBrushColor(double r, double g, double b)
    Sets the color for brush operations.
    void
    setBrushColor(float[] color)
    Sets the color for brush operations.
    void
    setBrushColor(float r, float g, float b)
    Sets the color for brush operations.
    void
    setBrushColor(int color)
    Sets the brush color.
    void
    setCharSpacing(float spacing)
     
    void
    setCropBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
    Sets the page CropBox.
    void
    Sets the default line dash pattern - solid line.
    void
    Sets the line width to the default.
    void
    Sets the graphics state.
    void
    setLineCapStyle(int style)
    Sets the current line cap style.
    void
    setLineJoinStyle(int style)
    Sets the line join style.
    void
    The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
    void
    setPenColor(double r, double g, double b)
    Sets the color for stroking operations.
    void
    setPenColor(float r, float g, float b)
    Sets the color for stroking operations.
    void
    setPenColor(int color)
    Sets the pen color.
    void
    setPenWidth(double width)
    Sets the pen width that will be used to draw lines and splines on this page.
    void
    setPenWidth(float width)
    Sets the pen width that will be used to draw lines and splines on this page.
    protected void
    setStructElementsPageObjNumber(int pageObjNumber)
     
    void
    setTextBegin(float x, float y)
     
    void
    setTextDirection(int degrees)
    Sets the text direction.
    void
    Sets the end of text block.
    void
     
    void
    setTextLeading(float leading)
    Sets the text leading.
    void
    setTextLocation(float x, float y)
    Sets the text location.
    void
    Sets the text rendering mode.
    void
    setTextRise(float rise)
     
    void
    setTextScaling(float scaling)
     
    void
    Sets the start of text block.
    void
    setTrimBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
    Sets the page TrimBox.
    void
    setWordSpacing(float spacing)
     
    void
    Draws the path using the current pen color.
    void
    transform(float[] values)
    Transformation matrix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • pdf

      protected PDF pdf
    • pageObj

      protected PDFobj pageObj
    • objNumber

      protected int objNumber
    • buf

      protected ByteArrayOutputStream buf
    • tm

      protected float[] tm
    • renderingMode

      protected int renderingMode
    • width

      protected float width
    • height

      protected float height
    • contents

      protected List<Integer> contents
    • annots

      protected List<net.atthegate.server.service.pdf.Annotation> annots
    • destinations

      protected List<Destination> destinations
    • cropBox

      protected float[] cropBox
    • bleedBox

      protected float[] bleedBox
    • trimBox

      protected float[] trimBox
    • artBox

      protected float[] artBox
    • structures

      protected List<StructElem> structures
    • savedHeight

      protected float savedHeight
    • MSCALE_X

      public static final int MSCALE_X
      See Also:
    • MSKEW_X

      public static final int MSKEW_X
      See Also:
    • MTRANS_X

      public static final int MTRANS_X
      See Also:
    • MSKEW_Y

      public static final int MSKEW_Y
      See Also:
    • MSCALE_Y

      public static final int MSCALE_Y
      See Also:
    • MTRANS_Y

      public static final int MTRANS_Y
      See Also:
  • Constructor Details

    • Page

      public Page(PDF pdf, float[] pageSize) throws Exception
      Creates page object and add it to the PDF document. Please note:
        The coordinate (0f, 0f) is the top left corner of the page.
        The size of the pages are represented in points.
        1 point is 1/72 inches.
        
      Parameters:
      pdf - the pdf object.
      pageSize - the page size of this page.
      Throws:
      Exception
    • Page

      public Page(PDF pdf, float[] pageSize, boolean addPageToPDF) throws Exception
      Creates page object and add it to the PDF document. Please note:
        The coordinate (0f, 0f) is the top left corner of the page.
        The size of the pages are represented in points.
        1 point is 1/72 inches.
        
      Parameters:
      pdf - the pdf object.
      pageSize - the page size of this page.
      addPageToPDF - boolean flag.
      Throws:
      Exception
    • Page

      public Page(PDF pdf, PDFobj pageObj) throws Exception
      Throws:
      Exception
  • Method Details

    • addResource

      public Font addResource(CoreFont coreFont, Map<Integer,PDFobj> objects)
    • addResource

      public void addResource(Image image, Map<Integer,PDFobj> objects)
    • addResource

      public void addResource(Font font, Map<Integer,PDFobj> objects)
    • complete

      public void complete(Map<Integer,PDFobj> objects) throws Exception
      Throws:
      Exception
    • getContent

      public byte[] getContent()
    • addDestination

      public Destination addDestination(String name, float yPosition)
      Adds destination to this page.
      Parameters:
      name - The destination name.
      yPosition - The vertical position of the destination on this page.
      Returns:
      the destination.
    • getWidth

      public float getWidth()
      Returns the width of this page.
      Returns:
      the width of the page.
    • getHeight

      public float getHeight()
      Returns the height of this page.
      Returns:
      the height of the page.
    • drawLine

      public void drawLine(double x1, double y1, double x2, double y2) throws IOException
      Draws a line on the page, using the current color, between the points (x1, y1) and (x2, y2).
      Parameters:
      x1 - the first point's x coordinate.
      y1 - the first point's y coordinate.
      x2 - the second point's x coordinate.
      y2 - the second point's y coordinate.
      Throws:
      IOException
    • drawLine

      public void drawLine(float x1, float y1, float x2, float y2) throws IOException
      Draws a line on the page, using the current color, between the points (x1, y1) and (x2, y2).
      Parameters:
      x1 - the first point's x coordinate.
      y1 - the first point's y coordinate.
      x2 - the second point's x coordinate.
      y2 - the second point's y coordinate.
      Throws:
      IOException
    • drawString

      public void drawString(Font font1, Font font2, String str, float x, float y) throws IOException
      Draws the text given by the specified string, using the specified main font and the current brush color. If the main font is missing some glyphs - the fallback font is used. The baseline of the leftmost character is at position (x, y) on the page.
      Parameters:
      font1 - the main font.
      font2 - the fallback font.
      str - the string to be drawn.
      x - the x coordinate.
      y - the y coordinate.
      Throws:
      IOException
    • drawString

      public void drawString(Font font, String str, double x, double y) throws IOException
      Draws the text given by the specified string, using the specified font and the current brush color. The baseline of the leftmost character is at position (x, y) on the page.
      Parameters:
      font - the font to use.
      str - the string to be drawn.
      x - the x coordinate.
      y - the y coordinate.
      Throws:
      IOException
    • drawString

      public void drawString(Font font, String str, float x, float y) throws IOException
      Draws the text given by the specified string, using the specified font and the current brush color. The baseline of the leftmost character is at position (x, y) on the page.
      Parameters:
      font - the font to use.
      str - the string to be drawn.
      x - the x coordinate.
      y - the y coordinate.
      Throws:
      IOException
    • setGraphicsState

      public void setGraphicsState(GraphicsState gs) throws IOException
      Sets the graphics state. Please see Example_31.
      Parameters:
      gs - the graphics state to use.
      Throws:
      IOException
    • setPenColor

      public void setPenColor(double r, double g, double b) throws IOException
      Sets the color for stroking operations. The pen color is used when drawing lines and splines.
      Parameters:
      r - the red component is float value from 0.0 to 1.0.
      g - the green component is float value from 0.0 to 1.0.
      b - the blue component is float value from 0.0 to 1.0.
      Throws:
      IOException
    • setPenColor

      public void setPenColor(float r, float g, float b) throws IOException
      Sets the color for stroking operations. The pen color is used when drawing lines and splines.
      Parameters:
      r - the red component is float value from 0.0f to 1.0f.
      g - the green component is float value from 0.0f to 1.0f.
      b - the blue component is float value from 0.0f to 1.0f.
      Throws:
      IOException
    • setBrushColor

      public void setBrushColor(double r, double g, double b) throws IOException
      Sets the color for brush operations. This is the color used when drawing regular text and filling shapes.
      Parameters:
      r - the red component is float value from 0.0 to 1.0.
      g - the green component is float value from 0.0 to 1.0.
      b - the blue component is float value from 0.0 to 1.0.
      Throws:
      IOException
    • setBrushColor

      public void setBrushColor(float r, float g, float b) throws IOException
      Sets the color for brush operations. This is the color used when drawing regular text and filling shapes.
      Parameters:
      r - the red component is float value from 0.0f to 1.0f.
      g - the green component is float value from 0.0f to 1.0f.
      b - the blue component is float value from 0.0f to 1.0f.
      Throws:
      IOException
    • setBrushColor

      public void setBrushColor(float[] color) throws IOException
      Sets the color for brush operations.
      Parameters:
      color - the color.
      Throws:
      IOException
    • getBrushColor

      public float[] getBrushColor()
      Returns the brush color.
      Returns:
      the brush color.
    • setPenColor

      public void setPenColor(int color) throws IOException
      Sets the pen color.
      Parameters:
      color - the color. See the Color class for predefined values or define your own using 0x00RRGGBB packed integers.
      Throws:
      IOException
    • setBrushColor

      public void setBrushColor(int color) throws IOException
      Sets the brush color.
      Parameters:
      color - the color. See the Color class for predefined values or define your own using 0x00RRGGBB packed integers.
      Throws:
      IOException
    • setDefaultLineWidth

      public void setDefaultLineWidth() throws IOException
      Sets the line width to the default. The default is the finest line width.
      Throws:
      IOException
    • setLinePattern

      public void setLinePattern(String pattern) throws IOException
      The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The elements of the dash array are positive numbers that specify the lengths of alternating dashes and gaps. The dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the dash array and the dash phase are expressed in user space units.
        Examples of line dash patterns:
      
            "[Array] Phase"     Appearance          Description
            _______________     _________________   ____________________________________
      
            "[] 0"              -----------------   Solid line
            "[3] 0"             ---   ---   ---     3 units on, 3 units off, ...
            "[2] 1"             -  --  --  --  --   1 on, 2 off, 2 on, 2 off, ...
            "[2 1] 0"           -- -- -- -- -- --   2 on, 1 off, 2 on, 1 off, ...
            "[3 5] 6"             ---     ---       2 off, 3 on, 5 off, 3 on, 5 off, ...
            "[2 3] 11"          -   --   --   --    1 on, 3 off, 2 on, 3 off, 2 on, ...
        
      Parameters:
      pattern - the line dash pattern.
      Throws:
      IOException
    • setDefaultLinePattern

      public void setDefaultLinePattern() throws IOException
      Sets the default line dash pattern - solid line.
      Throws:
      IOException
    • setPenWidth

      public void setPenWidth(double width) throws IOException
      Sets the pen width that will be used to draw lines and splines on this page.
      Parameters:
      width - the pen width.
      Throws:
      IOException
    • setPenWidth

      public void setPenWidth(float width) throws IOException
      Sets the pen width that will be used to draw lines and splines on this page.
      Parameters:
      width - the pen width.
      Throws:
      IOException
    • setLineCapStyle

      public void setLineCapStyle(int style) throws IOException
      Sets the current line cap style.
      Parameters:
      style - the cap style of the current line. Supported values: Cap.BUTT, Cap.ROUND and Cap.PROJECTING_SQUARE
      Throws:
      IOException
    • setLineJoinStyle

      public void setLineJoinStyle(int style) throws IOException
      Sets the line join style.
      Parameters:
      style - the line join style code. Supported values: Join.MITER, Join.ROUND and Join.BEVEL
      Throws:
      IOException
    • moveTo

      public void moveTo(double x, double y) throws IOException
      Moves the pen to the point with coordinates (x, y) on the page.
      Parameters:
      x - the x coordinate of new pen position.
      y - the y coordinate of new pen position.
      Throws:
      IOException
    • moveTo

      public void moveTo(float x, float y) throws IOException
      Moves the pen to the point with coordinates (x, y) on the page.
      Parameters:
      x - the x coordinate of new pen position.
      y - the y coordinate of new pen position.
      Throws:
      IOException
    • lineTo

      public void lineTo(double x, double y) throws IOException
      Draws a line from the current pen position to the point with coordinates (x, y), using the current pen width and stroke color. Make sure you call strokePath(), closePath() or fillPath() after the last call to this method.
      Throws:
      IOException
    • lineTo

      public void lineTo(float x, float y) throws IOException
      Draws a line from the current pen position to the point with coordinates (x, y), using the current pen width and stroke color. Make sure you call strokePath(), closePath() or fillPath() after the last call to this method.
      Throws:
      IOException
    • strokePath

      public void strokePath() throws IOException
      Draws the path using the current pen color.
      Throws:
      IOException
    • closePath

      public void closePath() throws IOException
      Closes the path and draws it using the current pen color.
      Throws:
      IOException
    • fillPath

      public void fillPath() throws IOException
      Closes and fills the path with the current brush color.
      Throws:
      IOException
    • drawRect

      public void drawRect(double x, double y, double w, double h) throws IOException
      Draws the outline of the specified rectangle on the page. The left and right edges of the rectangle are at x and x + w. The top and bottom edges are at y and y + h. The rectangle is drawn using the current pen color.
      Parameters:
      x - the x coordinate of the rectangle to be drawn.
      y - the y coordinate of the rectangle to be drawn.
      w - the width of the rectangle to be drawn.
      h - the height of the rectangle to be drawn.
      Throws:
      IOException
    • drawRect

      public void drawRect(float x, float y, float w, float h) throws IOException
      Draws the outline of the specified rectangle on the page. The left and right edges of the rectangle are at x and x + w. The top and bottom edges are at y and y + h. The rectangle is drawn using the current pen color.
      Parameters:
      x - the x coordinate of the rectangle to be drawn.
      y - the y coordinate of the rectangle to be drawn.
      w - the width of the rectangle to be drawn.
      h - the height of the rectangle to be drawn.
      Throws:
      IOException
    • fillRect

      public void fillRect(double x, double y, double w, double h) throws IOException
      Fills the specified rectangle on the page. The left and right edges of the rectangle are at x and x + w. The top and bottom edges are at y and y + h. The rectangle is drawn using the current pen color.
      Parameters:
      x - the x coordinate of the rectangle to be drawn.
      y - the y coordinate of the rectangle to be drawn.
      w - the width of the rectangle to be drawn.
      h - the height of the rectangle to be drawn.
      Throws:
      IOException
    • fillRect

      public void fillRect(float x, float y, float w, float h) throws IOException
      Fills the specified rectangle on the page. The left and right edges of the rectangle are at x and x + w. The top and bottom edges are at y and y + h. The rectangle is drawn using the current pen color.
      Parameters:
      x - the x coordinate of the rectangle to be drawn.
      y - the y coordinate of the rectangle to be drawn.
      w - the width of the rectangle to be drawn.
      h - the height of the rectangle to be drawn.
      Throws:
      IOException
    • drawPath

      public void drawPath(List<Point> path, char operation) throws Exception
      Draws or fills the specified path using the current pen or brush.
      Parameters:
      path - the path.
      operation - specifies 'stroke' or 'fill' operation.
      Throws:
      Exception
    • drawCircle

      public void drawCircle(double x, double y, double r) throws Exception
      Draws a circle on the page. The outline of the circle is drawn using the current pen color.
      Parameters:
      x - the x coordinate of the center of the circle to be drawn.
      y - the y coordinate of the center of the circle to be drawn.
      r - the radius of the circle to be drawn.
      Throws:
      Exception
    • drawCircle

      public void drawCircle(float x, float y, float r) throws Exception
      Draws a circle on the page. The outline of the circle is drawn using the current pen color.
      Parameters:
      x - the x coordinate of the center of the circle to be drawn.
      y - the y coordinate of the center of the circle to be drawn.
      r - the radius of the circle to be drawn.
      Throws:
      Exception
    • drawCircle

      public void drawCircle(double x, double y, double r, char operation) throws Exception
      Draws the specified circle on the page and fills it with the current brush color.
      Parameters:
      x - the x coordinate of the center of the circle to be drawn.
      y - the y coordinate of the center of the circle to be drawn.
      r - the radius of the circle to be drawn.
      operation - must be Operation.STROKE, Operation.CLOSE or Operation.FILL.
      Throws:
      Exception
    • drawCircle

      public void drawCircle(float x, float y, float r, char operation) throws Exception
      Draws the specified circle on the page and fills it with the current brush color.
      Parameters:
      x - the x coordinate of the center of the circle to be drawn.
      y - the y coordinate of the center of the circle to be drawn.
      r - the radius of the circle to be drawn.
      operation - must be Operation.STROKE, Operation.CLOSE or Operation.FILL.
      Throws:
      Exception
    • drawEllipse

      public void drawEllipse(double x, double y, double r1, double r2) throws Exception
      Draws an ellipse on the page using the current pen color.
      Parameters:
      x - the x coordinate of the center of the ellipse to be drawn.
      y - the y coordinate of the center of the ellipse to be drawn.
      r1 - the horizontal radius of the ellipse to be drawn.
      r2 - the vertical radius of the ellipse to be drawn.
      Throws:
      Exception
    • drawEllipse

      public void drawEllipse(float x, float y, float r1, float r2) throws Exception
      Draws an ellipse on the page using the current pen color.
      Parameters:
      x - the x coordinate of the center of the ellipse to be drawn.
      y - the y coordinate of the center of the ellipse to be drawn.
      r1 - the horizontal radius of the ellipse to be drawn.
      r2 - the vertical radius of the ellipse to be drawn.
      Throws:
      Exception
    • fillEllipse

      public void fillEllipse(double x, double y, double r1, double r2) throws Exception
      Fills an ellipse on the page using the current pen color.
      Parameters:
      x - the x coordinate of the center of the ellipse to be drawn.
      y - the y coordinate of the center of the ellipse to be drawn.
      r1 - the horizontal radius of the ellipse to be drawn.
      r2 - the vertical radius of the ellipse to be drawn.
      Throws:
      Exception
    • fillEllipse

      public void fillEllipse(float x, float y, float r1, float r2) throws Exception
      Fills an ellipse on the page using the current pen color.
      Parameters:
      x - the x coordinate of the center of the ellipse to be drawn.
      y - the y coordinate of the center of the ellipse to be drawn.
      r1 - the horizontal radius of the ellipse to be drawn.
      r2 - the vertical radius of the ellipse to be drawn.
      Throws:
      Exception
    • drawPoint

      public void drawPoint(Point p) throws Exception
      Draws a point on the page using the current pen color.
      Parameters:
      p - the point.
      Throws:
      Exception
    • setTextRenderingMode

      public void setTextRenderingMode(int mode) throws Exception
      Sets the text rendering mode.
      Parameters:
      mode - the rendering mode.
      Throws:
      Exception
    • setTextDirection

      public void setTextDirection(int degrees) throws Exception
      Sets the text direction.
      Parameters:
      degrees - the angle.
      Throws:
      Exception
    • bezierCurveTo

      public void bezierCurveTo(Point p1, Point p2, Point p3) throws IOException
      Draws a bezier curve starting from the current point. Please note: You must call the fillPath, closePath or strokePath method after the last bezierCurveTo call.

      Author: Pieter Libin, pieter@emweb.be

      Parameters:
      p1 - first control point
      p2 - second control point
      p3 - end point
      Throws:
      IOException
    • setTextStart

      public void setTextStart() throws IOException
      Sets the start of text block. Please see Example_32. This method must have matching call to setTextEnd().
      Throws:
      IOException
    • setTextLocation

      public void setTextLocation(float x, float y) throws IOException
      Sets the text location. Please see Example_32.
      Parameters:
      x - the x coordinate of new text location.
      y - the y coordinate of new text location.
      Throws:
      IOException
    • setTextBegin

      public void setTextBegin(float x, float y) throws IOException
      Throws:
      IOException
    • setTextLeading

      public void setTextLeading(float leading) throws IOException
      Sets the text leading. Please see Example_32.
      Parameters:
      leading - the leading.
      Throws:
      IOException
    • setCharSpacing

      public void setCharSpacing(float spacing) throws IOException
      Throws:
      IOException
    • setWordSpacing

      public void setWordSpacing(float spacing) throws IOException
      Throws:
      IOException
    • setTextScaling

      public void setTextScaling(float scaling) throws IOException
      Throws:
      IOException
    • setTextRise

      public void setTextRise(float rise) throws IOException
      Throws:
      IOException
    • setTextFont

      public void setTextFont(Font font) throws IOException
      Throws:
      IOException
    • println

      public void println(String str) throws IOException
      Prints a line of text and moves to the next line. Please see Example_32.
      Throws:
      IOException
    • print

      public void print(String str) throws IOException
      Prints a line of text. Please see Example_32.
      Throws:
      IOException
    • println

      public void println() throws IOException
      Move to the next line. Please see Example_32.
      Throws:
      IOException
    • setTextEnd

      public void setTextEnd() throws IOException
      Sets the end of text block. Please see Example_32.
      Throws:
      IOException
    • drawRectRoundCorners

      public void drawRectRoundCorners(float x, float y, float w, float h, float r1, float r2, char operation) throws Exception
      Throws:
      Exception
    • clipPath

      public void clipPath() throws IOException
      Clips the path.
      Throws:
      IOException
    • clipRect

      public void clipRect(float x, float y, float w, float h) throws IOException
      Throws:
      IOException
    • save

      public void save() throws IOException
      Throws:
      IOException
    • restore

      public void restore() throws IOException
      Throws:
      IOException
    • setCropBox

      public void setCropBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
      Sets the page CropBox. See page 77 of the PDF32000_2008.pdf specification.
      Parameters:
      upperLeftX - the top left X coordinate of the CropBox.
      upperLeftY - the top left Y coordinate of the CropBox.
      lowerRightX - the bottom right X coordinate of the CropBox.
      lowerRightY - the bottom right Y coordinate of the CropBox.
    • setBleedBox

      public void setBleedBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
      Sets the page BleedBox. See page 77 of the PDF32000_2008.pdf specification.
      Parameters:
      upperLeftX - the top left X coordinate of the BleedBox.
      upperLeftY - the top left Y coordinate of the BleedBox.
      lowerRightX - the bottom right X coordinate of the BleedBox.
      lowerRightY - the bottom right Y coordinate of the BleedBox.
    • setTrimBox

      public void setTrimBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
      Sets the page TrimBox. See page 77 of the PDF32000_2008.pdf specification.
      Parameters:
      upperLeftX - the top left X coordinate of the TrimBox.
      upperLeftY - the top left Y coordinate of the TrimBox.
      lowerRightX - the bottom right X coordinate of the TrimBox.
      lowerRightY - the bottom right Y coordinate of the TrimBox.
    • setArtBox

      public void setArtBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
      Sets the page ArtBox. See page 77 of the PDF32000_2008.pdf specification.
      Parameters:
      upperLeftX - the top left X coordinate of the ArtBox.
      upperLeftY - the top left Y coordinate of the ArtBox.
      lowerRightX - the bottom right X coordinate of the ArtBox.
      lowerRightY - the bottom right Y coordinate of the ArtBox.
    • append

      protected void append(String str) throws IOException
      Throws:
      IOException
    • append

      protected void append(int num) throws IOException
      Throws:
      IOException
    • append

      protected void append(float val) throws IOException
      Throws:
      IOException
    • append

      protected void append(char ch) throws IOException
      Throws:
      IOException
    • append

      protected void append(byte b) throws IOException
      Throws:
      IOException
    • append

      public void append(byte[] buffer) throws IOException
      Appends the specified array of bytes to the page.
      Throws:
      IOException
    • drawString

      protected void drawString(Font font, String str, float x, float y, Map<String,Integer> colors) throws Exception
      Throws:
      Exception
    • setStructElementsPageObjNumber

      protected void setStructElementsPageObjNumber(int pageObjNumber) throws Exception
      Throws:
      Exception
    • addBMC

      public void addBMC(String structure, String altDescription, String actualText) throws Exception
      Throws:
      Exception
    • addBMC

      public void addBMC(String structure, String language, String altDescription, String actualText) throws Exception
      Throws:
      Exception
    • addEMC

      public void addEMC() throws Exception
      Throws:
      Exception
    • addAnnotation

      protected void addAnnotation(net.atthegate.server.service.pdf.Annotation annotation)
    • beginTransform

      protected void beginTransform(float x, float y, float xScale, float yScale) throws Exception
      Throws:
      Exception
    • endTransform

      protected void endTransform() throws Exception
      Throws:
      Exception
    • drawContents

      public void drawContents(byte[] content, float h, float x, float y, float xScale, float yScale) throws Exception
      Throws:
      Exception
    • drawString

      public void drawString(Font font, String str, float x, float y, float dx) throws Exception
      Throws:
      Exception
    • addWatermark

      public void addWatermark(Font font, String text) throws Exception
      Throws:
      Exception
    • invertYAxis

      public void invertYAxis() throws Exception
      Throws:
      Exception
    • transform

      public void transform(float[] values) throws IOException
      Transformation matrix. Use save before, restore afterwards! 9 value array like generated by androids Matrix.getValues()
      Throws:
      IOException