Documentation

PdfUtils
in package

PDF utility class.

Table of Contents

Methods

closeQuietly()  : void
Closes a document, logging instead of throwing: never mask the error being handled.
hasSourceText()  : bool
hasSourceTextFromBytes()  : bool
Checks whether the file has source text.
withPdf()  : T
Opens a PDF, runs $fn on it, and always closes it.

Methods

closeQuietly()

Closes a document, logging instead of throwing: never mask the error being handled.

public static closeQuietly(PdfDocument|null $pdf) : void
Parameters
$pdf : PdfDocument|null

hasSourceText()

public static hasSourceText(string $pdfPath) : bool

since 3.4.0: use hasSourceTextFromBytes().

Parameters
$pdfPath : string
Return values
bool

hasSourceTextFromBytes()

Checks whether the file has source text.

public static hasSourceTextFromBytes(string $pdfData) : bool
Parameters
$pdfData : string

Raw byte string of the PDF file.

Return values
bool —

Returns true if the PDF has source text, false otherwise.

withPdf()

Opens a PDF, runs $fn on it, and always closes it.

public static withPdf(string $bytes, callable(PdfDocument): T $fn) : T
Parameters
$bytes : string
$fn : callable(PdfDocument): T
Tags
template
Return values
T
On this page

Search results