Package com.snowtide.pdf.layout
Interface Block
-
- All Superinterfaces:
BlockParent
,Bounded
,OutputSource
- All Known Subinterfaces:
Table
public interface Block extends Bounded, BlockParent, OutputSource
Instances of this class represent groupings of text at a specific position on aPage
.Blocks can contain
Lines
and/or other Blocks (via theBlockParent
interface). Existing implementations generally will not allow a Block to contain both Blocks and Lines.- Version:
- ©2004-2024 Snowtide
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Block
crop(Region area)
Returns aBlock
that contains only the content held by thisBlock
that intersects the given "query" area.Line
getLine(int idx)
Returns theLine
at the given index.int
getLineCnt()
Returns the number ofLine
s held by this Block.List<? extends Line>
getLines()
Returns a List view of theLine
s held by this Block.Direction
guessDirection()
Returns theDirection
of this block (in aggregate of all of its lines and child blocks, if any), determined via a heuristic that surveys all included text content.Line
removeLine(int idx)
Removes theLine
at the given index from this Block, and returns it.-
Methods inherited from interface com.snowtide.pdf.layout.BlockParent
addChild, getChild, getChildCnt, removeAllChildren, removeChild, replaceChild, sortChildren
-
Methods inherited from interface com.snowtide.pdf.OutputSource
pipe, pipe
-
-
-
-
Method Detail
-
getLines
List<? extends Line> getLines()
Returns a List view of theLine
s held by this Block. The returned List is guaranteed to offer efficient random access.- Since:
- v1.4
-
getLineCnt
int getLineCnt()
Returns the number ofLine
s held by this Block.- Since:
- v1.4
-
removeLine
Line removeLine(int idx)
Removes the
Line
at the given index from this Block, and returns it.- Since:
- v1.4
-
crop
Block crop(Region area)
Returns aBlock
that contains only the content held by thisBlock
that intersects the given "query" area. If all of the content held by this instance is intersected by the query area, then this instance may be returned unchanged. If no content in thisBlock
intersects the query area, then an emptyBlock
will be returned.
-
guessDirection
Direction guessDirection()
Returns theDirection
of this block (in aggregate of all of its lines and child blocks, if any), determined via a heuristic that surveys all included text content. This value is what determines the default base direction used when invokingOutputSource.pipe(OutputHandler)
.- Since:
- v4.0
-
-