Hi,
i am generating html to pdf using

require('html2fpdf.php');
	$pdf=new HTML2FPDF();
$dummy='<html><head>
					<style>
					.text11 {
						font-family: Arial, Helvetica, sans-serif;
						font-size: 11px;
						color: #434450;
						text-decoration: none;
						font-weight: bold;
					
					}
					.text111 {
						font-family: Arial, Helvetica, sans-serif;
						font-size: 12px;
						color: #AE4506;
						text-decoration: none;
						font-weight: bold;
					
					}
					.text122 {
						font-family: Arial, Helvetica, sans-serif;
						font-size: 11px;
						color: #00FFFF;
						text-decoration: none;
						font-weight: bold;
					
					}
					a.leftmenu {
						color: #AE4506;
						font-family: Arial, Helvetica, sans-serif;
						font-size: 11px;
						font-weight: bold;
						text-decoration:underline;
					}
					
					a.leftmenu:hover {
						color: #AE4506;
						font-family: Arial, Helvetica, sans-serif;
						font-size: 11px;
						font-weight: bold;
						text-decoration:none;
					}
					.borNavBlue {
						BORDER-RIGHT: #6698cb 1px solid; BORDER-TOP: #6698cb 1px solid; BORDER-LEFT: #6698cb 1px solid; BORDER-BOTTOM: #6698cb 1px solid
					}
					.bgNavBlue {
						BACKGROUND: #edf4fc
					}
					.trbgprj01{
						FONT-WEIGHT: normal; FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: tahoma; BACKGROUND-COLOR: #f0f0f0; TEXT-DECORATION: none
					}
					.trbgprj02{
						FONT-WEIGHT: normal; FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: tahoma; BACKGROUND-COLOR: #f8f8f8; TEXT-DECORATION: none
					}
					</style>
					</head>
					<body><TABLE width="100%"  border=0 align=center cellPadding=3 cellSpacing=1 bgColor=#EAEAEA>
						<br><TBODY>
						<TR bgcolor="#666666">  
							
							<TD colspan="2" align=left  class="text13">Vendor Information</TD>
						</TR><TR   bgColor=#FFFFFF>
						<TD width="35%" align=left class="text2">Vendor Name </TD>

						<TD width="65%" align=left class="text11"><B>Eifel</B></TD>
					</TR>
					<TR   bgColor=#FFFFFF>
						<TD width="35%" align=left class="text2">Bid Date</TD>
						<TD width="65%" align=left class="text11">2009-04-25 17:01:55</TD>
					</TR>
					<TR   bgColor=#FFFFFF>

						<TD width="35%" align=left class="text2">Contact Person</TD>
						<TD width="65%" align=left class="text11">Pratik Jain</TD>
					</TR>
					<TR   bgColor=#FFFFFF>
						<TD width="35%" align=left class="text2">Phone Number</TD>
						<TD width="65%" align=left class="text11">012-345-6789</TD>
					</TR>

					 <TR   bgColor=#FFFFFF>
						<TD width="35%" align=left class="text2">Vendor  Email Address </TD>
						<TD width="65%" align=left class="text11">test@test.com</TD>
					</TR><TR bgcolor="#666666"> 
						
						<TD colspan="2" align=left  class="text13">Vendor Bid Information</TD>
					</TR>
					
					
					<TR   bgColor=#FFFFFF>
						<TD width="35%" align=left class="text2">Customer Name </TD>

						<TD width="65%" align=left class="text11">IG Farben </TD>
					</TR>
					
					<TR   bgColor=#FFFFFF><td colspan="2">
					<TABLE class=borNavBlue cellSpacing=1 cellPadding=8 width="100%" align=center border=0>
										<TBODY>
										<TR class=bgNavBlue align=middle>
										<TH class="text111" align=middle width="9%" nowrap><b>Sr No.</b></TH>
										 
										<TH class="text111" align=middle width="26%"><b> Item Description</b></TH>               
										<TH class="text111" align=middle width="12%"> <b>Brand</b> </TH>

										<TH class="text111" align=middle width="26%"><b>Packing Description</b></TH>
										<TH class="text111" align=middle width="14%"><b>Quantity</b></TH>
										<TH class="text111" align=middle width="13%"><b>Price</b></TH>
										</TR><TR class="trbgprj02">
									<TD class="text11"   align=middle>1</TD>
									<TD  class="text11"  align=middle>Prodcut 1</TD>

									<TD class="text11"   align=middle> Brand1</TD>
									<TD  class="text11"  align=middle>Packing description 1</TD>
									<TD  class="text11"  align=middle>1</TD>
									<TD  class="text11"  align=middle>$ 3.00</TD>
									</TR><TR class="trbgprj01">
									<TD class="text11"   align=middle>2</TD>

									<TD  class="text11"  align=middle>Prodcut 2</TD>
									<TD class="text11"   align=middle> Brand2</TD>
									<TD  class="text11"  align=middle>Packing description 2</TD>
									<TD  class="text11"  align=middle>2</TD>
									<TD  class="text11"  align=middle>$ 2.00</TD>
									</TR></TBODY></table>

					</td>
					</tr>
					<TR   bgColor=#FFFFFF>
					<TD width="35%" align=left class="text2"><B>Total Order Amount</B></TD>
					<TD width="65%" align=left class="text111"><B>$ 7.00</B></TD>
					</TR></TBODY></TABLE></body></html>';
$pdf->AddPage();
$pdf->WriteHTML($dummy);
//echo $szBufferContent;
$pdf->Output();

my problem is html content is not properly conberted to pdf whereas css classes are available and i am able to generate excel sheet.but i am unable to generate pdf,please help and reply as early as possible.

thanks

can you post or send me the code to html2fpdf.php it might be you are miss calling the object class or there is a small error in it.

I did quite a bit of experimenting with html2PDF in the past. I have used it successfully for converting a schedule in a table to a PDF version. I put your code into my test environment and gave it a try. Here are a few observations:

1. You reference a text2 style but it isn't defined. In general however, I found that using inline styles is more likely to work.

2. html2pdf isn't very sophisticated when it comes to tables. If you keep it simple you can make it work but don't get too fancy. I don't think it can handle a table within a table. Once I removed that from your code, I was able to produce the output down to the customer name line. If you redesign it to use a single table, it will probably work.

3. I changed the code to produce the PDF a bit:

$dummy2 = AdjustHTML($dummy);
	$pdf->WriteHTML($dummy2);
	$pdf->Output("daniweb1.pdf");

Use whatever file name and location you want in the output statement.

You can see my notes on using HTML2PDF at:
innovationsdesign.net

It took me quite a lot of experimenting to determine how far I could push HTML2PDF. Hope this saves you some time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.