TCPDF Examples

Adding an image to TCPDF

$image_file = get_stylesheet_directory_uri() . '/CODA-logo-119x119.png'; // Note //the added slash
$pdf->Image($image_file, 10, 10, 35, '', 'PNG', '', 'T', false, 119, '', false, false, 0, false, false, false);

Adding space horizontally, for example the text in the below line was overlapping with logo. so the code to be used is as simple as below

$pdf->SetXY(10, 45);

full example of use of above code. in the below example there is also a use case of using horizontal space as the page heading was needed to put after the logo.

$image_file = get_stylesheet_directory_uri() . '/CODA-logo-119x119.png'; // Note //the added slash
    $pdf->Image($image_file, 10, 10, 35, '', 'PNG', '', 'T', false, 119, '', false, false, 0, false, false, false);
    $pdf->SetFont('helvetica', 'B', 20); // Set to bold and roughly 40px (TCPDF might not align exactly with pixel sizes, so you might need to experiment)
    $pdf->SetXY(80, 10); // Set the X and Y position of the text
    $pdf->MultiCell(0, 10, "COMMISSION OHIO DENTAL ASSISTANT CERTIFICATION", 0, 'L', false);
    $pdf->SetFont('helvetica', 'B', 12);
    $pdf->SetXY(10, 45);