I created a PDF generator with TCPDF
, it works ok, I'm just having a little problem.
I want the logo-marca
to enter, whatever I choose in the form.
Follow the codes.
Formulary code that sends the data ( index.php
)
<table align="right" width="100%">
<tr>
<td size="50px">Logo
<div style="padding-top:5px;">
<input name="logo" type="radio"
value="http://www.example.com/logo1.jpg" /> LOGO 1
<input name="logo" type="radio"
value="http://www.example.com/logo2.jpg" /> LOGO 2
<input name="logo" type="radio"
value="http://www.example.com/logo3.jpg" /> LOGO 3
</div>
</td>
</tr>
</table>
Code php
of the file that generates pdf
( invoice2.php
)
<?
require_once('tcpdf_include.php');
class MYPDF extends TCPDF {
public function Header() {
$image_file = 'http://www.example.com/logo.jpg';
//$pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '',
// '', false, 300, '', false, false, 0, $fitbox, false, false);
$this->Image($image_file,'',8,80,'', 'JPG', '', 'T', false, 300,
'L', false, false, 0, false, false, false);
}
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
}
}
I want you to, for example:
The person who chooses LOGO 1
, when generating PDF
, the image that was selected appears at the top of PDF
generated.
At the moment, the image that is appearing is the one that is in the code of invoice2.php
.
public function Header() {
$image_file = 'http://www.example.com/logo.jpg';
}
Could anyone help me with this?