SetaPDF_Extractor_Sorter_Baseline A sorter class that sorts lines by comparing the baseline of text items.

File: /SetaPDF v2/Extractor/Sorter/Baseline.php

Class hierarchy

Summary

Properties

$_baselineThreshold

Threshold which keeps items on the same line.

$_matrix

A temporary matrix used in the sort process.


Methods

_getItemsByOrientation()

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()

Sort lines vertically then horizontally.

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

getBaselineThreshold()

Get the threshold which keeps items on the same line.

groupByLines()

Groups all text items by lines.

Parameters
$textItems : SetaPDF_Extractor_TextItem[]

The text items

horizontallyThenVertically()

A sort callback that sort first horizontally then vertically.

Parameters
$a : SetaPDF_Extractor_TextItem
 
$b : SetaPDF_Extractor_TextItem
 
Exceptions

Throws SetaPDF_Core_Exception

See

isOnSameLine()

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

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

itemsJoining()

public SetaPDF_Extractor_Sorter::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 SetaPDF_Core_Exception

setBaselineThreshold()

public SetaPDF_Extractor_Sorter_Baseline::setBaselineThreshold (
float $threshold
): void

Set the threshold which keeps items on the same line.

Parameters
$threshold : float
 

verticallyThenHorizontally()

A sort callback that sort first vertically then horizontally.

Parameters
$a : SetaPDF_Extractor_TextItem
 
$b : SetaPDF_Extractor_TextItem
 
Exceptions

Throws SetaPDF_Core_Exception

See