- java.lang.Object
-
- com.itextpdf.text.pdf.draw.VerticalPositionMark
-
- com.itextpdf.text.pdf.draw.LineSeparator
-
- All Implemented Interfaces:
Element,DrawInterface
- Direct Known Subclasses:
DottedLineSeparator
public class LineSeparator extends VerticalPositionMark
Element that draws a solid line from left to right. Can be added directly to a document or column. Can also be used to create a separator chunk.- Since:
- 2.1.2
- Author:
- Paulo Soares
-
-
Field Summary
Fields Modifier and Type Field Description protected intalignmentThe alignment of the line.protected java.awt.ColorlineColorThe color of the line.protected floatlineWidthThe thickness of the line.protected floatpercentageThe width of the line as a percentage of the available page width.-
Fields inherited from class com.itextpdf.text.pdf.draw.VerticalPositionMark
drawInterface, offset
-
Fields inherited from interface com.itextpdf.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, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
-
-
Constructor Summary
Constructors Constructor Description LineSeparator()Creates a new instance of the LineSeparator class with default values: lineWidth 1 user unit, width 100%, centered with offset 0.LineSeparator(float lineWidth, float percentage, java.awt.Color lineColor, int align, float offset)Creates a new instance of the LineSeparator class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddraw(PdfContentByte canvas, float llx, float lly, float urx, float ury, float y)Implement this method if you want to draw something at the current Y position (for instance a line).voiddrawLine(PdfContentByte canvas, float leftX, float rightX, float y)Draws a horizontal line.intgetAlignment()Getter for the alignment of the line.java.awt.ColorgetLineColor()Getter for the color of the line that will be drawn.floatgetLineWidth()Getter for the line width.floatgetPercentage()Setter for the width as a percentage of the available width.voidsetAlignment(int align)Setter for the alignment of the line.voidsetLineColor(java.awt.Color color)Setter for the color of the line that will be drawn.voidsetLineWidth(float lineWidth)Setter for the line width.voidsetPercentage(float percentage)Setter for the width as a percentage of the available width.-
Methods inherited from class com.itextpdf.text.pdf.draw.VerticalPositionMark
getChunks, getDrawInterface, getOffset, isContent, isNestable, process, setDrawInterface, setOffset, type
-
-
-
-
Field Detail
-
lineWidth
protected float lineWidth
The thickness of the line.
-
percentage
protected float percentage
The width of the line as a percentage of the available page width.
-
lineColor
protected java.awt.Color lineColor
The color of the line.
-
alignment
protected int alignment
The alignment of the line.
-
-
Constructor Detail
-
LineSeparator
public LineSeparator(float lineWidth, float percentage, java.awt.Color lineColor, int align, float offset)Creates a new instance of the LineSeparator class.- Parameters:
lineWidth- the thickness of the linepercentage- the width of the line as a percentage of the available page widthlineColor- the color of the linealign- the alignmentoffset- the offset of the line relative to the current baseline (negative = under the baseline)
-
LineSeparator
public LineSeparator()
Creates a new instance of the LineSeparator class with default values: lineWidth 1 user unit, width 100%, centered with offset 0.
-
-
Method Detail
-
draw
public void draw(PdfContentByte canvas, float llx, float lly, float urx, float ury, float y)
Description copied from interface:DrawInterfaceImplement this method if you want to draw something at the current Y position (for instance a line).- Specified by:
drawin interfaceDrawInterface- Overrides:
drawin classVerticalPositionMark- Parameters:
canvas- the canvas on which you can drawllx- the x coordinate of the left page marginlly- the y coordinate of the bottom page marginurx- the x coordinate of the right page marginury- the y coordinate of the top page marginy- the current y position on the page- See Also:
DrawInterface.draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float)
-
drawLine
public void drawLine(PdfContentByte canvas, float leftX, float rightX, float y)
Draws a horizontal line.- Parameters:
canvas- the canvas to draw onleftX- the left x coordinaterightX- the right x coordindatey- the y coordinate
-
getLineWidth
public float getLineWidth()
Getter for the line width.- Returns:
- the thickness of the line that will be drawn.
-
setLineWidth
public void setLineWidth(float lineWidth)
Setter for the line width.- Parameters:
lineWidth- the thickness of the line that will be drawn.
-
getPercentage
public float getPercentage()
Setter for the width as a percentage of the available width.- Returns:
- a width percentage
-
setPercentage
public void setPercentage(float percentage)
Setter for the width as a percentage of the available width.- Parameters:
percentage- a width percentage
-
getLineColor
public java.awt.Color getLineColor()
Getter for the color of the line that will be drawn.- Returns:
- a color
-
setLineColor
public void setLineColor(java.awt.Color color)
Setter for the color of the line that will be drawn.- Parameters:
color- a color
-
getAlignment
public int getAlignment()
Getter for the alignment of the line.- Returns:
- an alignment value
-
setAlignment
public void setAlignment(int align)
Setter for the alignment of the line.- Parameters:
align- an alignment value
-
-