Jump to content

TCPDF and images


Recommended Posts

Hi

 

I am producing a letter using tcpdf and now want to insert an image version of my signature. (The letter generation minus the signature works fine.)

 

First of all I generate some fields from the mysql database and then put them into the code and generate the pdf. I have pasted the relevant part of the code below.

 

What I need to do is to add the signature image where it says [iNSERT DIGITAL COPY OF SIGNATURE]. I've tried various things but it doesn't seem to work.

 

Can anyone help please?

 

Many thanks

 

 

 

$htmlcontent = "<html>

 

<br><br><br><br>$printdate<br><br>

<u>To whom it may concern</u><br><br><br>

$company <br><br>

This letter is to confirm that Appointments Ltd has agreed to act as agent for $company in connection with the documents listed in the schedule hereto for $term years from the date of this letter.<br><br>

<br><br><br>

 

[iNSERT DIGITAL COPY OF SIGNATURE]<br><br>

 

For and on behalf of<br>

Appointments Ltd<br><br><br pagebreak=\"true\" />

 

<div style=\"text-align:center\"><strong>SCHEDULE</strong></div>

<div style=\"text-align:center\">Parties<span style=\"text-align:justify;\"><br><br>

 

";

 

while($row = mysql_fetch_array($result3))

{

$htmlcontent .= $row['doctitle']."<br />".$row['partylist']."<br /><br />";

}     

   

 

// create new PDF document

$pdf = new myPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); 

 

$pdf->SetPrintHeader(false);

// $pdf->SetPrintFooter(false);

 

// set default monospaced font

$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

 

//set margins

$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);

 

//set auto page breaks

$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

 

//set image scale factor

$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); 

 

//set some language-dependent strings

$pdf->setLanguageArray($l); 

 

// ---------------------------------------------------------

 

// set font

$pdf->SetFont('dejavusans', '', 10);

 

// add a page

$pdf->AddPage();

// create some HTML content

// set JPEG quality

$pdf->setJPEGQuality(100);

 

$pdf->Image('logonew.jpg', 70, 5, 73, 20, '', '', '', true, 100);

 

 

// output the HTML content

$pdf->writeHTML($htmlcontent, true, 0, true, 0, '');

// $pdf->writeHTML($html, true, false, true, false, '');

 

// $pdf->writeHTML($inlinecss, true, 0, true, 0);

 

// reset pointer to the last page

// $pdf->lastPage();

 

//Close and output PDF document

// $pdf->Output('example_006.pdf', 'I');

$directory = '../docs/';

$docname = 'Letter_of_Confirmation_' . $appidpassed . '.pdf';

$path=$directory.$docname;

$pdf->Output($path, 'F'); 

 

 

Link to comment
https://forums.phpfreaks.com/topic/236008-tcpdf-and-images/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.