setasign\SetaPDF2\Extractor\Filter
RectangleFilter A rectangle filter.
File: /SetaPDF v2/Extractor/Filter/RectangleFilter.php
Old class name (alias):
\SetaPDF_Extractor_Filter_Rectangle
This filter allows you to define a rectangle which is used to filter text items. This filter automatically takes care of rotated pages/coordinate systems.
The origin of the coordinate system is the lower left throughout.
Class hierarchy
Implements
Summary
Constants
MODE_CONTACT
A mode constant.
This mode says that the text item has to contact the rectangle of this filter instance through any point or intersection.
MODE_CONTAINS
A mode constant.
This mode says that the whole text item has to be contained by the rectangle of this filter instance.
Properties
$_id
The id of this filter.
$_page
The current page object.
Methods
__construct()
string $mode = RectangleFilter::MODE_CONTACT,
?string $id = null
The constructor.
The filter can work in 2 modes, which can be controlled by the 2nd paramter of the constructor:
- MODE_CONTACT: This mode will match tangent items.
- MODE_CONTAINS: This mode will match if the rectangle contains the whole text item.
Parameters
- $rectangle : \SetaPDF_Core_Geometry_Rectangle
The rectangle to filter by.
- $mode : string
A mode constant.
- $id : ?string
The filter id.
_contact()
Checks whether the rectangle and the text items contacting each other.
Parameters
- $textItem : \SetaPDF_Extractor_TextItem
Exceptions
_contains()
Checks whether the rectangle contains the item or not.
Parameters
- $textItem : \SetaPDF_Extractor_TextItem
Exceptions
accept()
Method that is called to decide if a text item accepted or not.
Parameters
- $textItem : \SetaPDF_Extractor_TextItem
Exceptions
Throws \setasign\SetaPDF2\Extractor\Exception
Throws \setasign\SetaPDF2\Core\Exception
See
getRectangle()
Get the rectangle.
Parameters
- $ignoreTransform : bool
Whether to ignore the transformation (rotation and translation of the page coordinate syste) or not.