Package com.itextpdf.text.pdf.draw
Class VerticalPositionMark
- java.lang.Object
-
- com.itextpdf.text.pdf.draw.VerticalPositionMark
-
- All Implemented Interfaces:
Element
,DrawInterface
- Direct Known Subclasses:
LineSeparator
public class VerticalPositionMark extends java.lang.Object implements DrawInterface, Element
Helper class implementing the DrawInterface. Can be used to add horizontal or vertical separators. Won't draw anything unless you implement the draw method.- Since:
- 2.1.2
-
-
Field Summary
Fields Modifier and Type Field Description protected DrawInterface
drawInterface
Another implementation of the DrawInterface; its draw method will overrule LineSeparator.draw().protected float
offset
The offset for the line.-
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, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
-
-
Constructor Summary
Constructors Constructor Description VerticalPositionMark()
Creates a vertical position mark that won't draw anything unless you define a DrawInterface.VerticalPositionMark(DrawInterface drawInterface, float offset)
Creates a vertical position mark that won't draw anything unless you define a DrawInterface.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw(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).java.util.List<Chunk>
getChunks()
Gets all the chunks in this element.DrawInterface
getDrawInterface()
Getter for the interface with the overruling draw() method.float
getOffset()
Getter for the offset relative to the baseline of the current line.boolean
isContent()
Checks if this element is a content object.boolean
isNestable()
Checks if this element is nestable.boolean
process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.void
setDrawInterface(DrawInterface drawInterface)
Setter for the interface with the overruling draw() method.void
setOffset(float offset)
Setter for the offset.int
type()
Gets the type of the text element.
-
-
-
Field Detail
-
drawInterface
protected DrawInterface drawInterface
Another implementation of the DrawInterface; its draw method will overrule LineSeparator.draw().
-
offset
protected float offset
The offset for the line.
-
-
Constructor Detail
-
VerticalPositionMark
public VerticalPositionMark()
Creates a vertical position mark that won't draw anything unless you define a DrawInterface.
-
VerticalPositionMark
public VerticalPositionMark(DrawInterface drawInterface, float offset)
Creates a vertical position mark that won't draw anything unless you define a DrawInterface.- Parameters:
drawInterface
- the drawInterface for this vertical position mark.offset
- the offset for this vertical position mark.
-
-
Method Detail
-
draw
public void draw(PdfContentByte canvas, float llx, float lly, float urx, float ury, float y)
Description copied from interface:DrawInterface
Implement this method if you want to draw something at the current Y position (for instance a line).- Specified by:
draw
in interfaceDrawInterface
- 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.itextpdf.text.pdf.PdfContentByte, float, float, float, float, float)
-
process
public boolean process(ElementListener listener)
Description copied from interface:Element
Processes the element by adding it (or the different parts) to anElementListener
.- Specified by:
process
in interfaceElement
- Parameters:
listener
- anElementListener
- Returns:
true
if the element was processed successfully- See Also:
Element.process(com.itextpdf.text.ElementListener)
-
type
public int type()
Description copied from interface:Element
Gets the type of the text element.- Specified by:
type
in interfaceElement
- Returns:
- a type
- See Also:
Element.type()
-
isContent
public boolean isContent()
Description copied from interface:Element
Checks if this element is a content object. If not, it's a metadata object.- Specified by:
isContent
in interfaceElement
- Returns:
- true if this is a 'content' element; false if this is a 'metadata' element
- See Also:
Element.isContent()
-
isNestable
public boolean isNestable()
Description copied from interface:Element
Checks if this element is nestable.- Specified by:
isNestable
in interfaceElement
- Returns:
- true if this element can be nested inside other elements.
- See Also:
Element.isNestable()
-
getChunks
public java.util.List<Chunk> getChunks()
Description copied from interface:Element
Gets all the chunks in this element.- Specified by:
getChunks
in interfaceElement
- Returns:
- an
ArrayList
- See Also:
Element.getChunks()
-
getDrawInterface
public DrawInterface getDrawInterface()
Getter for the interface with the overruling draw() method.- Returns:
- a DrawInterface implementation
-
setDrawInterface
public void setDrawInterface(DrawInterface drawInterface)
Setter for the interface with the overruling draw() method.- Parameters:
drawInterface
- a DrawInterface implementation
-
getOffset
public float getOffset()
Getter for the offset relative to the baseline of the current line.- Returns:
- an offset
-
setOffset
public void setOffset(float offset)
Setter for the offset. The offset is relative to the current Y position. If you want to underline something, you have to choose a negative offset.- Parameters:
offset
- an offset
-
-