right align logo in tcpdf header

Smudger picture Smudger · Feb 7, 2014 · Viewed 11k times · Source

I have the following tcdpf syntax in my php document:

$title="My Heading";
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.$title, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));

The logo appears on the left, how can I right align the logo and left align $title?

Answer

alpakyol picture alpakyol · Feb 7, 2014

You must define custom header to align image. This example shows how to do this.

To align your logo right, you must set palign attribute to 'R' in image definition.

$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, 'R', false, false, 0,     false, false, false);

Note that, your header data string position may not be what you want as. You will probably

need to play with several attributes, but in basic, image alignment can be done only via

overriding default Header() function as far as I know.

Check also Image() function.