Problem with pdf creation

<?php $letter_format="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Bank Letter of $Student_Name</title>
<link href='Letter_Styles.css' rel='stylesheet' type='text/css' />


</head>

<body>
<p align='left'><b>Date:</b>&nbsp;". date('F j, Y')." </p>
<p>To<br />
  The Manager<br />
  ......................... Bank<br />
  London </p>
<p>&nbsp;</p>
<p><b>Student Name:</b>&nbsp;".$Student_Name."<br />
  <b>Address:</b>&nbsp;".$row_record_student['house_no'].",&nbsp;".$row_record_student['street'].",&nbsp;".$row_record_student['town'].",&nbsp;".$row_record_student['postcode'].". </p>
<p>&nbsp;</p>
<p><b>Date of birth:</b>&nbsp;".date('F j, Y',strtotime($row_record_student['date_of_birth']))." <br />
  <b>Student number:</b>&nbsp;".$row_record_student['reg_number']." </p>
<p>&nbsp;</p>
<p>We are delighted to confirm that the above-mentioned student has been enrolled without any condition with the course detailed below.</p>
<table width='90%' border='0' align='left' cellpadding='0' cellspacing='0' >
  <tr>
    <td width='250'><strong>Course</strong></td>
    <td width='627'><b>:</b>&nbsp;".$course_ttl."</td>
  </tr>
  <tr>
    <td width='250'><strong>Course Mode</strong></td>
    <td width='627'><b>:</b>".$studymode."</td>
  </tr>
  <tr>
    <td width='250'><strong>Commencement date</strong></td>
    <td width='627'><b>:</b> ".$course_start_date."</td>
  </tr>
  <tr>
    <td width='250'><strong>Expected completion date</strong></td>
    <td width='627'><b>:</b> ".$course_end_date."</td>
  </tr>
  <tr>
    <td width='250'><strong>Awarding Body</strong></td>
    <td width='627'><b>:</b> ".$awardingbody."</td>
  </tr>  
 
  <tr>
    <td width='173'><strong>Tuition fees</strong></td>
    <td width='627'><b>:</b>&nbsp;&pound;".$Total_Fees."</td>
  </tr>
  <tr>
    <td width='173'><strong>Fees Paid</strong></td>
    <td width='627'><b>:</b>&nbsp;&pound;".$Fees_paid."</td>
  </tr>
  <tr>
    <td width='173'><strong>Balance Fees</strong></td>
    <td width='627'><b>:</b>&nbsp;&pound;".$Due_Amount."</td>
  </tr>
</table>
<p><br/>
    <br/>
    <br/><br/>
<br/>
    <br/>
</p>
<p>      <br/>
    <br/>
    <br/>
    <br/>
   
</p>
<p><strong style='text-decoration:underline;'>Overseas Address:</strong><br /><br />".$row_record_student['overseas_address']."</p>
<p>Please do not hesitate to contact the  admissions office in case of further queries.</p>
<p><strong>Yours sincerely</strong></p>
<p>&nbsp;</p>
<p><strong>Admissions Officer</strong></p>

</body>
</html>";
?>

I want to convert $letter_format into pdf format. I have used html2pdfclass for convrting and if i convert it into pdf i need to convert $letter_format into html first.how can i do it?

I found a PHP class called dompdf at http://code.google.com/p/dompdf/, its very simply to use an you don’t need to change your source above at all. See the documentation and download below.

Download
Documentation

Thank you. your suggestion is helpful for me.

I am facing another problem. when i convert html into pdf images become small in converted pdf file. what should i do if i want to show images as like html view?

you can also use mpdf
http://mpdf.bpm1.com/download

hi SgtLegend,

I am facing another problem. when i convert html into pdf file, images or logo become small in converted pdf file.But it is right in html view. what should i do if i want to show images or logo as like html view?

I want to add watermark during pdf creation. how can i do it using dompdf?

You would need to ask over at the dompdf’s Google page about the image sizes as it may be cropping them for a specific reason. To watermark the images you would need to do this on the fly using a watermark script/class which you can find by Goggling “PHP watermark class”.