setasign\SetaPDF2\Extractor\Sorter

FlexLineSorter A sorter class that sorts lines by comparing text items on their baseline and a threshold factor.

File: /SetaPDF v2/Extractor/Sorter/FlexLineSorter.php
Old class name (alias): \SetaPDF_Extractor_Sorter_FlexLine

This sorter is not able to detect if an item lies on top of another one!

Class hierarchy

Summary

Properties

$_matrix

A temporary matrix used in the sort process.


Methods

_getItemsByOrientation()

Groups items by their orientation.

Parameters
$textItems : \setasign\SetaPDF2\Extractor\TextItem[]
 
Return Values

An array grouped by the orientation holding both their items (grouped by their ordinate) and the associated orientation matrix.

_sortLinesVerticallyThenHorizontally()

Sort lines vertically then horizontally.

Parameters
$lines : array<string, array{items: array<string, \setasign\SetaPDF2\Extractor\TextItem[]>, matrix: \setasign\SetaPDF2\Core\Geometry\Matrix}>
 

groupByLines()

Groups all text items by lines.

Parameters
$textItems : \setasign\SetaPDF2\Extractor\TextItem[]

The text items

Exceptions

Throws \setasign\SetaPDF2\Core\Exception

horizontallyThenVertically()

itemsJoining()

Checks if two items joining each other.

Parameters
$a : \setasign\SetaPDF2\Extractor\TextItem

Item A.

$b : \setasign\SetaPDF2\Extractor\TextItem

Item B.

$spaceWidthFactor : float

The space width factor.

Exceptions

Throws \setasign\SetaPDF2\Core\Exception

verticallyThenHorizontally()