Hi

I have an html file with a complex table structure.
I read in the html file in and then render the contents using WriteHTML.php
It turns out quite differently.
ex: width, font size, nested tables (don't seem to be working).
I am stuck and don't know how to fix these issues

Below is a portion of my html

    <div align=center>
    <br/>
    <table  style='width: 900px;  color: black;  border: 1px solid DimGray;'>
    <tr style='background-color: #F5F5F5;'>
        <td style='font-family: Arial;   font-size: 16px;   color: black;   width: 450px;' valign=top>
        <b>CERTIFICATE OF LIABILITY INSURANCE</b>
        </td>       
        <td align='center' style=' font-family: Arial;   font-size: 15px;   width: 450px; color: black; '>
        <b>Date (MM/DD/YY)</b><br/>
        ---
        </td>       
    </tr>
    <tr>
        <td width=420 valign=top style='font-family: Arial;   font-size: 15px;   color: black;border-right:1px solid DimGray;border-bottom:1px solid DimGray; '>
        Some address<br/>
        goes here
                </td>

        <td width=480 valign=top style='font-family: Arial;   font-size: 13px;   color: black;border-bottom:1px solid DimGray; '>
        THIS CERTIFICATE IS ISSUED AS A MATTER OF INFORMATION
        ONLY AND CONFERS NO RIGHTS UPON THE CERTIFICATE
        HOLDER. THIS CERTIFICATE DOES NOT AMEND, EXTEND OR
        ALTER THE COVERAGE AFFORDED BY THE POLICIES BELOW.
        </td>
    </tr>
    <tr>
        <td width=450 valign=top style='font-family: Arial;   font-size: 15px;   color: black;border-right:1px solid DimGray; '>
        <textarea rows=5 cols=30 style='font-family: Arial;   font-size: 15px;   color: black;border:0px solid DimGray;' readonly>ECT Professional
        Some address
        goes here/textarea>
        </td>

        <td width=450 valign=top style='font-family: Arial;   font-size: 11px;   color: black;border-left:0px solid DimGray; '>
            <table width=450>
            <tr style='background-color: #F5F5F5;'>
                <td style=' font-family: Arial;   font-size: 11px;'><b>INSURERS AFFORDING COVERAGE</b></td>
                <td style=' font-family: Arial;   font-size: 11px;'><b>NAIC #</b></td>
            </tr>
            <tr>
                <td style=' font-family: Arial;   font-size: 11px;'>INSURER A:  Economical</td>
                <td style=' font-family: Arial;   font-size: 11px;'>A</td>
            </tr>
            <tr style='background-color: #F5F5F5;'>
                <td style=' font-family: Arial;   font-size: 11px;'>INSURER B: Disney World</td>
                <td style=' font-family: Arial;   font-size: 11px;'>B</td>
            </tr>
            <tr>
                <td style=' font-family: Arial;   font-size: 11px;'>INSURER C: Disneyland</td>
                <td style=' font-family: Arial;   font-size: 11px;'>C</td>
            </tr>
            <tr style='background-color: #F5F5F5;'>
                <td style=' font-family: Arial;   font-size: 11px;'>INSURER D: Wonderland</td>
                <td style=' font-family: Arial;   font-size: 11px;'>D</td>
            </tr>
            <tr>
                <td style=' font-family: Arial;   font-size: 11px;'>INSURER E: 5 Star</td>
                <td style=' font-family: Arial;   font-size: 11px;'>E</td>
            </tr></table>

        </td>

    </tr>

    </table>

Something's wrong with your code. When I copy provided HTML file you provided and display it into file, I get entirely different result than two ones you provided.

After fixing the HTML syntax, missing </textarea> and couple other glitches such as missing metrics of objects. The code I've been left with is: PasteBin link here. This code translates into PDF exactly well.

Please, for love of coding, use external CSS files instead of placing them inline of HTML. Inline CSS makes it harder to read. This is also most common and standard way to give HTML selectors proper styling.

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.