When adding a custom font and trying to use it in the document’s Footer, an exception is thrown.
Steps to Reproduce
- Add a custom font via
AddFont().
- Override the
Footer() method and add text using that font.
- Generate a PDF with
AddPage() and Output().
Minimal Example
<?php
require __DIR__ . '/vendor/autoload.php';
use setasign\SetaFpdf\SetaFpdf;
class BrokenFooter extends SetaFpdf {
function __construct() {
parent::__construct();
$this->AddFont('testArial','', __DIR__ . '/Arial.ttf');
}
function Footer() {
$this->SetY(-15);
$this->Cell(0, 10, 'This Footer is broken!');
}
}
$BrokenFooter = new BrokenFooter();
$BrokenFooter->AddPage();
$BrokenFooter->SetFont('testArial','',16);
$BrokenFooter->Cell(0,10,'Hello World!');
$BrokenFooter->Output('F', __DIR__ . '/broken-footer.pdf');
Expected Behavior
A PDF should be generated with:
- Body text: Hello World!
- Footer: This Footer is broken!
Actual Behavior
An exception is thrown:
Fatal error: Uncaught InvalidArgumentException: Unknown property "numTables" in table. in vendor/setasign/setapdf-core/library/SetaPDF/Core/Font/TrueType/Table/AbstractTable.php:190
Notes
- The issue only occurs when using custom fonts.
- The footer works fine with built-in fonts.
When adding a custom font and trying to use it in the document’s
Footer, an exception is thrown.Steps to Reproduce
AddFont().Footer()method and add text using that font.AddPage()andOutput().Minimal Example
Expected Behavior
A PDF should be generated with:
Actual Behavior
An exception is thrown:
Fatal error: Uncaught InvalidArgumentException: Unknown property "numTables" in table. in vendor/setasign/setapdf-core/library/SetaPDF/Core/Font/TrueType/Table/AbstractTable.php:190Notes