I cannot include an image in a TCPDF header

Jayu picture Jayu · Jul 31, 2010 · Viewed 18k times · Source

To create a custom header and footer, I used TCPDF's header() and footer() functions, but when I try to include an image in the header using the function $this->image(), the image cannot be displayed. Other images in the document are working fine.

Answer

Manie picture Manie · Aug 3, 2010

Try this example:

$pdf->SetHeaderData("image.jpg", PDF_HEADER_LOGO_WIDTH, "Application PDF", "Application Form\nRaining Pesos, Inc. - www.rainingpesos.com");

The first parameter is where you put the image on the header, but make sure on your path image config,

define ('K_PATH_IMAGES', '/images/');

make sure the images that you want to display on the pdf is in the folder you set, in this example the folder 'images' contains the 'image.jpg'.

Hope it helps!