pdftk_adapter
Infrastructure service to handle PDF manipulations using PDFTk.
Wrapper around mikehaertl/php-pdftk.
Table of Contents
Properties
- $binary_path : null|string
Methods
- get_instance() : Pdf
- Get a configured instance of the PDFTk wrapper.
- is_available() : bool
- Check if PDFTk is available and executable.
- uncompress_content() : string
- Uncompress a PDF file stream.
- is_executable_path() : bool
- Verify if a path exists and is executable.
- resolve_binary_path() : string|null
- Resolve the path to the PDFTk binary.
Properties
$binary_path
private
static null|string
$binary_path
= null
Cache for the resolved binary path
Methods
get_instance()
Get a configured instance of the PDFTk wrapper.
public
static get_instance([null|array<string|int, mixed>|string $pdf_path = null ]) : Pdf
Parameters
- $pdf_path : null|array<string|int, mixed>|string = null
-
path to PDF file or array of paths
Tags
Return values
Pdfis_available()
Check if PDFTk is available and executable.
public
static is_available() : bool
Return values
booluncompress_content()
Uncompress a PDF file stream.
public
static uncompress_content(string $content) : string
Useful for parsing PDF content.
Parameters
- $content : string
-
Raw PDF content
Tags
Return values
string —Uncompressed PDF content
is_executable_path()
Verify if a path exists and is executable.
private
static is_executable_path(string $path) : bool
Parameters
- $path : string
Return values
boolresolve_binary_path()
Resolve the path to the PDFTk binary.
private
static resolve_binary_path() : string|null
Priority:
- Moodle Config (local_middag | pdftk_path)
- Local bin folder (legacy support)
- System PATH (where/which).