setasign\SetaPDF2\Extractor\Sorter

AbstractSorter The abstract sorter class.

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

Class hierarchy

Summary

Properties

$_matrix

A temporary matrix used in the sort process.


Methods

_getItemsByOrientation()

protected AbstractSorter::_getItemsByOrientation (): array<string, array{items: array<string, \SetaPDF_Extractor_TextItem[]>, matrix: \SetaPDF_Core_Geometry_Matrix}>

Groups items by their orientation.

Parameters
$textItems : \SetaPDF_Extractor_TextItem[]
 
Return Values

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

_sortLinesVerticallyThenHorizontally()

protected AbstractSorter::_sortLinesVerticallyThenHorizontally (
array<string, array{items: array<string, \SetaPDF_Extractor_TextItem[]>, matrix: \SetaPDF_Core_Geometry_Matrix}> $lines
): array<int, \SetaPDF_Extractor_TextItem>

Sort lines vertically then horizontally.

Parameters
$lines : array<string, array{items: array<string, \SetaPDF_Extractor_TextItem[]>, matrix: \SetaPDF_Core_Geometry_Matrix}>
 

groupByLines()

abstract public AbstractSorter::groupByLines (): array

Groups all text items by lines.

Parameters
$textItems : \SetaPDF_Extractor_TextItem[]

The text items

horizontallyThenVertically()

isOnSameLine()

Checks whether two items are on the same line or not.

This method has to be implemented by the extending classes.

Parameters
$a : \SetaPDF_Extractor_TextItem
 
$b : \SetaPDF_Extractor_TextItem
 
$matrix : ?\SetaPDF_Core_Geometry_Matrix
 

itemsJoining()

public AbstractSorter::itemsJoining (
\SetaPDF_Extractor_TextItem $a,
\SetaPDF_Extractor_TextItem $b,
float $spaceWidthFactor = 2.0
): bool

Checks if two items joining each other.

Parameters
$a : \SetaPDF_Extractor_TextItem

Item A.

$b : \SetaPDF_Extractor_TextItem

Item B.

$spaceWidthFactor : float

The space width factor.

Exceptions

Throws \setasign\SetaPDF2\Core\Exception

verticallyThenHorizontally()