Firstly, I am new here so if I am postign in the wrong area I am sorry.
Secondly, I am new to this so dont luagh at my stupidity I think of it as a talent for getting things messed up :)

I have urgent problem, converting Html to PDF - a simple invoice that looks like this:

http://www.bbbeeeme.co.za/design.php

I have tried Html2Pdf,DomPdf,MPDF56 ... evryone of these has a different thing I dont understand ... lol

The weird thing is when I run it to cpnvert the cells dont alling text is mess all the same colour and size, the empty lines are gone so everything is moved up the width is no where near what I set to its way bigger.

Is there anoyone that understands these things tthat could guide me, I am losing my mind after four days now.

me code here:

<style type="text/css">
<!--
.style1 {
    font-size: 24px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
}
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
.style8 {color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
.style10 {
    font-size: 18px;
    font-family: Arial, Helvetica, sans-serif;
}
.style11 {font-size: 12px}
.style12 {font-family: Arial, Helvetica, sans-serif}
.style13 {font-size: 12px; font-family: Arial, Helvetica, sans-serif; }
.style15 {font-size: 14px; font-family: Arial, Helvetica, sans-serif; }
.style16 {font-size: 14px}
.style18 {color: #666666}
.style20 {font-size: 12px; font-family: Arial, Helvetica, sans-serif; color: #999999; }
.style21 {color: #999999}
.style22 {color: #FFFFFF}
.style23 {color: #000000}
-->
</style>
<table width="738" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" rowspan="6"><img src="http://www.bbbeeeme.co.za/logo.jpg" width="338" height="100"></td>
    <td colspan="2" align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><span class="style23"></span></td>
    <td valign="top" align="right"><span class="style23"><span class="style1">INVOICE</span>..</span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr>
    <td align="right" class="style13"><span class="style15 style11 style18"><span class="style13">Invoice 

Number: </span></span></td>
    <td align="center">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="style13"><span class="style15 style11 style18"><span 

class="style13">Date:</span></span></td>
    <td valign="top" align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="style13"><span class="style15 style11 style18"><span class="style13">Due 

Date:</span></span></td>
    <td valign="top" align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="262">&nbsp;</td>
    <td width="137" valign="top" align="right">&nbsp;</td>
    <td width="21">&nbsp;</td>
  </tr>
</table>
<table width="741" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="153" align="right"><span class="style20">Client Name: </span></td>
    <td width="333"><span class="style16"></span></td>
    <td width="243">&nbsp;</td>
    <td width="244"><span class="style22">..</span></td>
  </tr>
  <tr>
    <td><span class="style21"></span></td>
    <td><span class="style16"></span></td>
    <td>&nbsp;</td>
    <td><span class="style22">..</span></td>
  </tr>
  <tr>
    <td align="right"><span class="style20">Address:</span></td>
    <td><span class="style16"></span></td>
    <td>&nbsp;</td>
    <td><span class="style22">..</span></td>
  </tr>
  <tr>
    <td><span class="style21"></span></td>
    <td><span class="style16"></span></td>
    <td>&nbsp;</td>
    <td><span class="style22">..</span></td>
  </tr>
  <tr>
    <td><span class="style21"></span></td>
    <td><span class="style16"></span></td>
    <td>&nbsp;</td>
    <td><span class="style22">..</span></td>
  </tr>
  <tr>
    <td align="right"><span class="style20">Telephone:</span></td>
    <td><span class="style16"></span></td>
    <td>&nbsp;</td>
    <td><span class="style22">..</span></td>
  </tr>
  <tr>
    <td align="right"><span class="style20">Email:</span></td>
    <td><span class="style16"></span></td>
    <td>&nbsp;</td>
    <td><span class="style22">..</span></td>
  </tr>
  <tr>
    <td align="right"><span class="style20">Cell:</span></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td><span class="style16"></span></td>
    <td>&nbsp;</td>
    <td><span class="style22">..</span></td>
  </tr>
</table>
<table width="733" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#323232">
    <td width="113" height="30" align="center"><span class="style8">CODE</span></td>
    <td width="207" align="center"><span class="style8">DESCRIPTION</span></td>
    <td width="135" align="center"><span class="style8">PRICE</span></td>
    <td width="75" align="center"><span class="style8">QTY</span></td>
    <td width="96" align="center"><span class="style8">VAT</span></td>
    <td width="105" align="center"><span class="style8">TOTAL</span></td>
  </tr>
</table>
<table width="733" align="center" cellpadding="0" cellspacing="0">
  <tr bordercolor="#F0F0F0" class="style13">
    <td width="113" align="center">&nbsp;</td>
    <td width="207">&nbsp;</td>
    <td width="135">&nbsp;</td>
    <td width="75"><span class="style23"></span></td>
    <td width="96"><span class="style23"></span></td>
    <td width="105"><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td>&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#F0F0F0">
    <td align="center">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="733" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#323232">class="style13"> 
    <td width="113" align="center">&nbsp;</td>
    <td width="207"><span class="style23"></span></td>
    <td width="135"><span class="style23"></span></td>
    <td width="75"><span class="style23"></span></td>
    <td width="96"><span class="style23"></span></td>
    <td width="105"><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td colspan="2" align="center"><span class="style23"></span><span class="style23">TOTAL</span></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td align="center">&nbsp;</td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
  <tr bordercolor="#F0F0F0" class="style13">
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
    <td><span class="style23"></span></td>
  </tr>
</table>
<table width="735" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#000000">
    <td colspan="2"><span class="style10"></span>n<span class="style10"></span>k</td>
    <td width="409">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><span class="style10">Bank Details </span></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="97" align="right" class="style11 style12">Bank:</td>
    <td width="227">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="style13">Account:</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="style13">Branch:</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="style13">Type:</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr bgcolor="#000000">
    <td>Hostitza</td>
    <td><span class="style10"></span></td>
    <td>&nbsp;</td>
  </tr>
</table>
<p>&nbsp;</p>

Thank you :)

Recommended Answers

All 4 Replies

I used HTML2PDF (Click Here) quite successfully in the past. The main limitation is that you need to have properly constructed HTML. I don't know if what you provided above was intentionally just a series of fragments but it doesn't have <head> or <body> statements and that would probably give it a problem.

Chris - Thank you, was at that page three days ago, doe snot work sorry, even though it is posted there - my dear sir I would also like to point out, you say I should use these head body tags and point to me to the very source that say we should not ... :)

I quote

"This library has been made to assist in the creation of PDF files, not to directly convert an HTML page.You can not use the <html>, <head>, <body> tags. Read carefully the examples."

That is why I removed them - you also cannot use DIV v-allign ... I appologise for being more confused now. Do you use the Head Body tags ?

Hi looking at your code line 218 and it is displaying the html code for the class on the screen of your invoice page.

  <tr bgcolor="#323232">class="style13"> 

This needs to be like this

  <tr bgcolor="#323232 class="style13"> 

this will not help with your alignment.

It may not help but it's a start

D

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.