Documentation

MYPDF extends PdfRenderer
in package

Base class for all PDF documents in the app.

Extends TCPDF directly, TCPDF requires inheritance to override Header() and Footer() in each document.

Originally split across PDFController and AbstractDebugPDF (task #48636), merged here to simplify the hierarchy.

Provides font setup helpers, encoding sanitizers, and accessors to some of TCPDF's private properties that are useful for debugging.

Table of Contents

Methods

__construct()  : mixed
currentUnicodeState()  : int
Whether the current font supports unicode. Returns 0 or 1.
fixBoldMissing()  : void
Adds the bold variant of the default font in case it wasn't loaded automatically.
fixFontFiles()  : void
If FontFiles is empty and env is set, falls back to the default font.
Footer()  : void
getCoreFonts()  : mixed
The core font list from the TCPDF library.
getCurrentFont()  : array<string|int, mixed>
Full description of the current font including vector coordinates.
getDefaultFontKey()  : string
Returns the font key used as default (e.g. 'helvetica').
getFontFamily()  : string
Name of the currently active font family.
getFontFiles()  : array<string|int, mixed>
Font file definitions loaded by TCPDF.
getFontKeys()  : array<string|int, mixed>
Keys of all fonts currently loaded.
getNumFonts()  : int
Total number of fonts loaded.
getOwnerDetails()  : string
getPageDetails()  : string
getPdfAMode()  : bool
Whether PDF/A mode is active.
getProtectedFontBuffer()  : mixed
Returns the buffer description for a specific font key.
getState()  : int
Current state of the PDF generation process.
sanitizer()  : string
Simpler version of sanitizerPOP — encodes and decodes without replacing < >.
sanitizerPOP()  : string
Sanitizes a string for PDF output using WINDOWS-1252 encoding.
setDefaultFont()  : void
Sets the default font as the active font.
setFontPath()  : void
Updates the fontdir path for each loaded font file.
setOwnerDetails()  : void
setPageDetails()  : void

Methods

__construct()

public __construct(mixed $env) : mixed
Parameters
$env : mixed

currentUnicodeState()

Whether the current font supports unicode. Returns 0 or 1.

public currentUnicodeState() : int
Return values
int

fixBoldMissing()

Adds the bold variant of the default font in case it wasn't loaded automatically.

public fixBoldMissing() : void

fixFontFiles()

If FontFiles is empty and env is set, falls back to the default font.

public fixFontFiles() : void

Useful when the font cache is missing or incomplete.

getCoreFonts()

The core font list from the TCPDF library.

public getCoreFonts() : mixed

getCurrentFont()

Full description of the current font including vector coordinates.

public getCurrentFont() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDefaultFontKey()

Returns the font key used as default (e.g. 'helvetica').

public getDefaultFontKey() : string
Return values
string

getFontFamily()

Name of the currently active font family.

public getFontFamily() : string
Return values
string

getFontFiles()

Font file definitions loaded by TCPDF.

public getFontFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFontKeys()

Keys of all fonts currently loaded.

public getFontKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>

getNumFonts()

Total number of fonts loaded.

public getNumFonts() : int
Return values
int

getOwnerDetails()

public getOwnerDetails() : string
Return values
string

getPageDetails()

public getPageDetails() : string
Return values
string

getPdfAMode()

Whether PDF/A mode is active.

public getPdfAMode() : bool
Return values
bool

getProtectedFontBuffer()

Returns the buffer description for a specific font key.

public getProtectedFontBuffer(string $fontKey) : mixed
Parameters
$fontKey : string

getState()

Current state of the PDF generation process.

public getState() : int
Return values
int

sanitizer()

Simpler version of sanitizerPOP — encodes and decodes without replacing < >.

public sanitizer(string $raw[, string $encoding = 'WINDOWS-1252' ]) : string
Parameters
$raw : string
$encoding : string = 'WINDOWS-1252'
Return values
string

sanitizerPOP()

Sanitizes a string for PDF output using WINDOWS-1252 encoding.

public sanitizerPOP(string $raw[, string $encoding = 'WINDOWS-1252' ]) : string

Also escapes < and > to avoid breaking the HTML parser inside TCPDF.

Parameters
$raw : string
$encoding : string = 'WINDOWS-1252'
Return values
string

setDefaultFont()

Sets the default font as the active font.

public setDefaultFont() : void

setFontPath()

Updates the fontdir path for each loaded font file.

public setFontPath() : void

setOwnerDetails()

public setOwnerDetails(string $details) : void
Parameters
$details : string

setPageDetails()

public setPageDetails(string $details) : void
Parameters
$details : string

        
On this page

Search results