Hi

I am using fpdf.php to create a pdf from my php code.

However, my output needs to be in a table format and when I add this:

    $sMsg     = "
        <div align=center> <table  style='width: 900px;  color: black;  border: 1px solid DimGray;'> <tr> <td style='font-family: Arial;   font-size: 22px;   color: black;   width: 700px;' valign=top>
            ACORD™ CERTIFICATE OF LIABILITY INSURANCE
            </td> <td align='center' style=' font-family: Arial;   font-size: 15px;   color: black;border-left:1px solid DimGray; '> <b>Date (MM/DD/YY)</b><br/>
            $sTemp1
            </td> </tr></table>
        ";

I get this in my pdf:
How do I get this to properly format my html?

  <div align=center> <table  style='width: 900px;  color: black;  border: 1px solid DimGray;'><tr><td style='font-family: Arial;   font-size: 22px;   color: black;   width: 700px;' valign=top> etc.etc.

Recommended Answers

All 4 Replies

You would make PHP file parse the data and write it in the file. There's this website that can convert HTML to PDF for you.

If you're looking for automated process. I would do almost same, except write the file in external HTML file and ask FPDF.php the parsed HTML file and parse to PDF. Given you already know how to use it.

Hi

Thank you for answering me.

I was able to successfully create an html file from my php output.

Now I need to automatically process this html file and convert it to a pdf

How do I do this?

You may take a look at this post. It gives you an idea of what other script you need in order to convert it from PHP to PDF. If you really want to implement it yourself, it will be a long process; besides, you will need to know how to encode/decode for PDF...

Now I need to automatically process this html file and convert it to a pdf How do I do this?

I am using fpdf.php to create a pdf from my php code.

Just use your FPDF.php, to create .PDF from your parsed .HTML file. After creating parsed HTML file, take it's name to FPDF.php and get PDF file out of it.

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.