Reputation: 13
Can someone tell me how to right align a textfield using TCPDF? So, for a textfield like this, which is a numeric, how to I align on the right?
$pdf->TextField('number_of_crews', 20, 5, array('charLimit'=>3,'multiline'=>true, 'lineWidth'=>0, 'borderStyle'=>'none', 'defaultStyle' => array('textFont'=>array('fontWeight'=>'bold'))), array('v' => {number_of_crews}));
Upvotes: 0
Views: 491
Reputation: 71
According to the source code (https://tcpdf.org/docs/srcdoc/TCPDF/source-class-TCPDF_STATIC/#653) you set it in the prop array like so:
$prop = array( 'alignment' => 'right' );
As it pertains to you code, it would look like this:
$pdf->TextField('number_of_crews', 20, 5, array(
'charLimit'=>3,
'multiline'=>true,
'lineWidth'=>0,
'borderStyle'=>'none',
'alignment'=>'right',
'defaultStyle' => array(
'textFont'=>array(
'fontWeight'=>'bold'
)
)
), array('v' => {number_of_crews}));
Upvotes: 1