com.lowagie.text

Class Graphic

Implemented Interfaces:
Element

public class Graphic
extends PdfContentByte
implements Element

A Graphic element can contain several geometric figures (curves, lines,...).

If you want to use this Element, please read the Sections 8.4 and 8.5 of the PDF Reference Manual version 1.3 first.

See Also:
Element

Nested Class Summary

Nested classes/interfaces inherited from class com.lowagie.text.pdf.PdfContentByte

PdfContentByte.GraphicState

Field Summary

static String
BORDER
This is a type of Graphic.
static String
HORIZONTAL_LINE
This is a type of Graphic.
private HashMap
attributes
Contains some of the attributes for this Graphic.

Fields inherited from class com.lowagie.text.pdf.PdfContentByte

ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, LINE_CAP_BUTT, LINE_CAP_PROJECTING_SQUARE, LINE_CAP_ROUND, LINE_JOIN_BEVEL, LINE_JOIN_MITER, LINE_JOIN_ROUND, TEXT_RENDER_MODE_CLIP, TEXT_RENDER_MODE_FILL, TEXT_RENDER_MODE_FILL_CLIP, TEXT_RENDER_MODE_FILL_STROKE, TEXT_RENDER_MODE_FILL_STROKE_CLIP, TEXT_RENDER_MODE_INVISIBLE, TEXT_RENDER_MODE_STROKE, TEXT_RENDER_MODE_STROKE_CLIP, abrev, content, layerDepth, pdf, separator, state, stateList, unitRect, writer

Fields inherited from interface com.lowagie.text.Element

ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITTG3_1D, CCITTG3_2D, CCITTG4, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE

Constructor Summary

Graphic()
Constructs a Graphic-object.

Method Summary

void
drawBorder(float lineWidth, Color color, float llx, float lly, float urx, float ury)
Draws a border
void
drawHorizontalLine(float lineWidth, Color color, float x1, float x2, float y)
draws a horizontal line.
ArrayList
getChunks()
Gets all the chunks in this element.
boolean
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.
void
processAttributes(float llx, float lly, float urx, float ury, float y)
Processes the attributes of this object.
void
setBorder(float linewidth, float extraSpace)
Orders this graphic to draw a horizontal line.
void
setBorder(float linewidth, float extraSpace, Color color)
Orders this graphic to draw a horizontal line.
void
setHorizontalLine(float linewidth, float percentage)
Orders this graphic to draw a horizontal, centered line.
void
setHorizontalLine(float linewidth, float percentage, Color color)
Orders this graphic to draw a horizontal, centered line.
void
setHorizontalLine(float linewidth, float percentage, Color color, int align)
Orders this graphic to draw a horizontal, centered line.
void
setHorizontalLine(float linewidth, float percentage, int align)
Orders this graphic to draw a horizontal line with some alignment.
int
type()
Gets the type of the text element.

Methods inherited from class com.lowagie.text.pdf.PdfContentByte

HelperCMYK, HelperRGB, add, addAnnotation, addImage, addImage, addImage, addImage, addOutline, addOutline, addPSXObject, addTemplate, addTemplate, addTemplateReference, arc, beginLayer, beginLayer2, beginMarkedContentSequence, beginMarkedContentSequence, beginMarkedContentSequence, beginText, bezierArc, checkNoPattern, checkWriter, circle, clip, closePath, closePathEoFillStroke, closePathFillStroke, closePathStroke, compareColors, concatCTM, createAppearance, createAppearance, createGraphics, createGraphics, createGraphics, createGraphics, createGraphicsShapes, createGraphicsShapes, createPattern, createPattern, createPattern, createPattern, createPrinterGraphics, createPrinterGraphics, createPrinterGraphics, createPrinterGraphics, createPrinterGraphicsShapes, createPrinterGraphicsShapes, createTemplate, createTemplate, curveFromTo, curveTo, curveTo, drawButton, drawRadioField, drawTextField, ellipse, endLayer, endMarkedContentSequence, endText, eoClip, eoFill, eoFillStroke, escapeString, escapeString, fill, fillStroke, getCharacterSpacing, getDuplicate, getEffectiveStringWidth, getHorizontalScaling, getInternalBuffer, getKernArray, getLeading, getPageResources, getPdfDocument, getPdfWriter, getRootOutline, getWordSpacing, getXTLM, getYTLM, lineTo, localDestination, localGoto, moveText, moveTextWithLeading, moveTo, newPath, newlineShowText, newlineShowText, newlineText, outputColorNumbers, paintShading, paintShading, rectangle, rectangle, remoteGoto, remoteGoto, reset, resetCMYKColorFill, resetCMYKColorStroke, resetGrayFill, resetGrayStroke, resetRGBColorFill, resetRGBColorStroke, restoreState, roundRectangle, saveState, setAction, setCMYKColorFill, setCMYKColorFillF, setCMYKColorStroke, setCMYKColorStrokeF, setCharacterSpacing, setColorFill, setColorFill, setColorStroke, setColorStroke, setDefaultColorspace, setFlatness, setFontAndSize, setGState, setGrayFill, setGrayStroke, setHorizontalScaling, setLeading, setLineCap, setLineDash, setLineDash, setLineDash, setLineDash, setLineJoin, setLineWidth, setLiteral, setLiteral, setLiteral, setMiterLimit, setPatternFill, setPatternFill, setPatternFill, setPatternStroke, setPatternStroke, setPatternStroke, setRGBColorFill, setRGBColorFillF, setRGBColorStroke, setRGBColorStrokeF, setShadingFill, setShadingStroke, setTextMatrix, setTextMatrix, setTextRenderingMode, setTextRise, setWordSpacing, showText, showText, showText2, showTextAligned, showTextAligned, showTextAlignedKerned, showTextKerned, size, stroke, toPdf, toString, transform, variableRectangle

Field Details

BORDER

public static final String BORDER
This is a type of Graphic.

HORIZONTAL_LINE

public static final String HORIZONTAL_LINE
This is a type of Graphic.

attributes

private HashMap attributes
Contains some of the attributes for this Graphic.

Constructor Details

Graphic

public Graphic()
Constructs a Graphic-object.

Method Details

drawBorder

public void drawBorder(float lineWidth,
                       Color color,
                       float llx,
                       float lly,
                       float urx,
                       float ury)
Draws a border
Parameters:
lineWidth - linewidth of the border
color - color of the borderbox
llx - lower left x coordinate
lly - lower left y coordinate
urx - upper right x coordinate
ury - upper right y coordinate

drawHorizontalLine

public void drawHorizontalLine(float lineWidth,
                               Color color,
                               float x1,
                               float x2,
                               float y)
draws a horizontal line.
Parameters:
lineWidth - width of the line
color - color of the line
x1 - start position of the line
x2 - end position of the line
y - y-coordinate of the line

getChunks

public ArrayList getChunks()
Gets all the chunks in this element.
Specified by:
getChunks in interface Element
Returns:
an ArrayList

process

public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.
Specified by:
process in interface Element
Parameters:
listener - an ElementListener true if the element was processed successfully
Returns:
true if processing this object succeeded

processAttributes

public void processAttributes(float llx,
                              float lly,
                              float urx,
                              float ury,
                              float y)
Processes the attributes of this object.
Parameters:
llx - lower left x coordinate
lly - lower left y coordinate
urx - upper right x coordinate
ury - upper right y coordinate
y -

setBorder

public void setBorder(float linewidth,
                      float extraSpace)
Orders this graphic to draw a horizontal line.
Parameters:
linewidth - linewidth of the border
extraSpace - extraspace needed as marging on the page

setBorder

public void setBorder(float linewidth,
                      float extraSpace,
                      Color color)
Orders this graphic to draw a horizontal line.
Parameters:
linewidth - linewidth of the border
extraSpace - extraspace needed as marging on the page
color - color of the borderbox

setHorizontalLine

public void setHorizontalLine(float linewidth,
                              float percentage)
Orders this graphic to draw a horizontal, centered line.
Parameters:
linewidth - the line width
percentage - the percentage horizontal width in relation to the margins or if negative, an absolute value

setHorizontalLine

public void setHorizontalLine(float linewidth,
                              float percentage,
                              Color color)
Orders this graphic to draw a horizontal, centered line.
Parameters:
linewidth - the line width
percentage - the percentage horizontal width in relation to the margins or if negative, an absolute value
color - the color of the line

setHorizontalLine

public void setHorizontalLine(float linewidth,
                              float percentage,
                              Color color,
                              int align)
Orders this graphic to draw a horizontal, centered line.
Parameters:
linewidth - the line width
percentage - the percentage horizontal width in relation to the margins or if negative, an absolute value
color - the color of the line
align - the line alignment

setHorizontalLine

public void setHorizontalLine(float linewidth,
                              float percentage,
                              int align)
Orders this graphic to draw a horizontal line with some alignment.
Parameters:
linewidth - the line width
percentage - the percentage horizontal width in relation to the margins or if negative, an absolute value
align - the line alignment

type

public int type()
Gets the type of the text element.
Specified by:
type in interface Element
Returns:
a type