在php中的dompdf中并排对齐表

时间:2016-04-25 17:10:01

标签: php css

我想在dompdf中将表(由不同列排序)彼此相邻显示。 Css在dompdf中不起作用。我试着漂浮:左,但它不起作用。

PHP和CSS代码如下:

PHP代码:

require_once ('dompdf_config.inc.php');

$pdf_content='
            <!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" />

            <style type="text/css"> 
            body{
            font-size:9px;
                }                       
        table {border-collapse: collapse; }
         th, td { padding: 5px; } 
        .floatedTable {
            float:left;
                      }

        .inlineTable {
            display: inline-block;
        }
            </style>
            </head>             
            <body>
            <div >';

                $pdf_content.='<table align="left" width="250px" border="1" cellspacing="0" cellpadding="1"> <tr > <td> <b>Govt Fund</b> </td><td>Rs</td><td>College Fund </td><td>Rs </td></tr><tr> <td>Admission Fee</td><td> </td><td>Sports Fund </td><td> </td></tr></table> <table  align="left" width="250px" border="1" cellspacing="0" cellpadding="1"> <tr > <td> <b>Govt Fund</b> </td><td>Rs</td><td>College Fund </td><td>Rs </td></tr><tr> <td>Admission Fee</td><td> </td><td>Sports Fund </td><td> </td></tr><tr> <td>Tution Fee</td><td> </td><td>General Fund </td><td> </td></tr><tr> <td>College Leaving Certificate Fee</td><td> </td><td>Library Fee </td><td> </td></tr></table>';

            $pdf_content.='</div></body></html>';
            $name = date("Ymd").rand().'.pdf';

    $pdf_userid=12; 
    $dompdf=new DOMPDF();
    $dompdf->load_html($pdf_content);
    $dompdf->render();
    $output = $dompdf->output();
    $dompdf->stream("Result.pdf", array("Attachment" => false));

0 个答案:

没有答案