I want to generate PDF. I am using FPDF to generate pdf file. I generate the pdf with the content text and image. Now i want to make the image as background image. So the scenario is text would be over image. I tried many solution but any solution is working for me. I generated the PDF using below code.
$pdf = new FPDF();
$title = 'Without User Details';
$img_title = 'Your Voucher Image is-: ';
$php2pdf = '';
$php2pdf .= 'Your Voucher Code is-: ';
$php2pdf .= $voucher_prefix;
$php2pdf .= get_post_meta($post->ID, 'voucher_start_digit', true);
if (has_post_thumbnail( $post->ID ) ):
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
$image_url = $image[0];
endif;
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->SetTitle($title);
$pdf->MultiCell($w, $h, $title);
$pdf->Ln(3);
$pdf->Cell(90,90,$php2pdf);
$pdf->Ln(20);
$pdf->MultiCell(40, 10, $img_title);
$pdf->Image($image_url,30,60,90,0); ob_start();
$pdf->Output();
ob_end_flush();
I got the answer !!! It is by using Transparency of FPDF. For that we have to use its extended Alphapdf class.
Reference : http://www.fpdf.org/en/script/script74.php