Pdf_Parser implements Parser_Interface

Shared PDF extraction, execution timer and fatal recovery context.

Tags

Interfaces, Classes and Traits

Parser_Interface
Interface for document parsers.

Table of Contents

$active_backend  : string
Backend name retained through fatal shutdown.
$active_file_path  : string
File retained through fatal shutdown, including normalization.
$timer_enforced  : bool|null
Result of the most recent timer enforcement attempt.
extract()  : string
Extract and normalize using exactly one backend.
failure_diagnostic()  : string
Add backend and failure category to the existing customer diagnostic.
get_backend()  : string
Selected backend name, safe to obtain on PHP 7.4.
get_diagnostics()  : array<string|int, mixed>
Runtime selection and timer diagnostics for Site Health.
is_available()  : bool
Whether a backend can be selected before parsing.
is_parsing()  : bool
Whether a PDF is active, including normalization.
configured_time_limit()  : int
Positive integer seconds; invalid filter results retain the default.
effective_time_limit()  : int
Do not increase an existing positive PHP execution limit.
normalize_text()  : string
Normalize parser output.
select_backend()  : array<string|int, mixed>
Select without touching PrinsFrank source on unsupported PHP or hosts.
set_execution_limit()  : bool
Best-effort PHP execution timer, not a wall-clock deadline.

Properties

$active_backend

Backend name retained through fatal shutdown.

private static string $active_backend = ''
Tags

$active_file_path

File retained through fatal shutdown, including normalization.

private static string $active_file_path = ''
Tags

$timer_enforced

Result of the most recent timer enforcement attempt.

private static bool|null $timer_enforced
Tags

Methods

extract()

Extract and normalize using exactly one backend.

public extract(string $file_path) : string
Parameters
$file_path : string

Absolute PDF path.

Tags
throws
Parse_Exception

When extraction or normalization fails.

Return values
string —

failure_diagnostic()

Add backend and failure category to the existing customer diagnostic.

public static failure_diagnostic(string $message, string $category) : string
Parameters
$message : string

Failure details.

$category : string

Failure category.

Tags
Return values
string —

get_backend()

Selected backend name, safe to obtain on PHP 7.4.

public static get_backend() : string
Tags
Return values
string —

get_diagnostics()

Runtime selection and timer diagnostics for Site Health.

public static get_diagnostics() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —

is_available()

Whether a backend can be selected before parsing.

public static is_available() : bool
Tags
Return values
bool —

is_parsing()

Whether a PDF is active, including normalization.

public static is_parsing([string $file_path = '' ]) : bool
Parameters
$file_path : string = ''

Optional expected PDF path.

Tags
Return values
bool —

configured_time_limit()

Positive integer seconds; invalid filter results retain the default.

private static configured_time_limit() : int
Tags
Return values
int —

effective_time_limit()

Do not increase an existing positive PHP execution limit.

private static effective_time_limit(int $previous) : int
Parameters
$previous : int

Previous execution limit in seconds.

Tags
Return values
int —

normalize_text()

Normalize parser output.

private normalize_text(string $text) : string
Parameters
$text : string

Parser output.

Tags
Return values
string —

select_backend()

Select without touching PrinsFrank source on unsupported PHP or hosts.

private static select_backend() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —

set_execution_limit()

Best-effort PHP execution timer, not a wall-clock deadline.

private static set_execution_limit(int $limit) : bool
Parameters
$limit : int

Execution limit in seconds.

Tags
Return values
bool —

Search results