You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm trying find a way to alter text font size in a table cell. I created a callback which is used but can't make the font change its size.
Any help will be appreciated.
`///Wrapper Class to generate pdf reports
class CSpdf extends Cezpdf {
public function __construct($paper = 'a4', $orientation = 'portrait', $type = 'none', $options = array()) {
parent::__construct($paper, $orientation, $type, $options);
$this->allowedTags .= '|fontsize:?.*?';
$this->isUnicode = true;
$this->fontPath = dirname(__FILE__).'/fonts';
// select a font and use font subsetting
$aFontSubset = array(
'b' => 'Arial-Unicode-Bold.ttf',
'i' => 'Arial-Unicode-Italic.ttf',
'bi' => 'Arial-Unicode-Bold-Italic.ttf',
'ib' => 'Arial-Unicode-Bold-Italic.ttf'
);
$this->setFontFamily('Arial-Unicode-Regular', $aFontSubset);
$this->selectFont('Arial-Unicode-Regular.ttf');
}
/**
* callback function to alter font height text.
*
* **Example**<br>
* <pre>
* $pdf->ezText('<c:fontsize:10>Sample Text</c:fontsize>');
* </pre>
*
* @param $info
*/
public function fontsize($info) {
switch($info['status']) {
case 'start':
//$this->saveState();
//addTextWrap($x, $y, $size, $text, $width = 0, $justification = 'left', $angle = 0, $wordSpaceAdjust = 0, $test = 0)
//addText($x, $y, $size, $text, $width, $justification, $angle, $wordSpaceAdjust, $test);
$this->ez['fontSize'] = $info['p'];
$this->addText($info['x'], $info['y'], $info['p'], '');
//$this->selectFont($this->cs_fontpath.'/'.$this->currentFont);
break;
case 'end':
$this->ez['fontSize'] = $info['p'];
//$this->selectFont($this->cs_fontpath.'/'.$this->currentFont);
//$this->restoreState();
break;
case 'sol':
case 'eol':
break;
default:
break;
}
}
It seems that the addText function which calls the callbacks already holds a copy of the $size of the text.
This means that no matter what you change on the ez['fontSize'] as the addText will apply the local $size parameter provided to the addText function.
Hi,
I'm trying find a way to alter text font size in a table cell. I created a callback which is used but can't make the font change its size.
Any help will be appreciated.
`///Wrapper Class to generate pdf reports
class CSpdf extends Cezpdf {
}`
Report
`$cols = array();
$data[] = array('test', 'testingasda', '<c:fontsize:8>test8</c:fontsize>', '');
$aParams = array(
'xPos' => 'left',
'xOrientation' => 'right',
'showLines' => 0,
'fontSize' => $report_textsize,
'showHeadings' => 1,
'shaded' => 0,
'shadeCol2' => array(0.9, 0.9, 0.9),
'width' => 555,
'cols' => array(
0 => array('justification' => 'right')));
$pdf->ezTable($data, $cols, '', $aParams);
`
The text was updated successfully, but these errors were encountered: