How to place two tables on the same line in ezpdf creation (PHP)

0

I was looking at the documentation of that framework for PHP and I can not put two tables together in the same row. Could it be?

The documentation is in this Link

<?php
    include_once '../src/Cezpdf.php';
    $pdf = new CezPDF("a4");

    $pdf->selectFont('Helvetica');

    $data = array(
     array('num'=>1,'name'=>'gandalf','type'=>'wizard')
    ,array('num'=>2,'name'=>'bilbo','type'=>'hobbit','url'=>'asd')
    ,array('num'=>3,'name'=>'frodo','type'=>'hobbit')
    ,array('num'=>4,'name'=>'saruman','type'=>'bad dude','url'=>'asdd')
    ,array('num'=>5,'name'=>'sauron','type'=>'really bad dude')
    );
    $cols = array('num'=>'No', 'type'=>'Type','name'=>'<i>Alias</i>');
    $coloptions = array('num'=> array('justification'=>'right'), 'name'=> array('justification'=>'left'),'type'=> array('justification'=>'center'));

    $pdf->ezText("<b>GRIDLINE</b>", 12);

    $pdf->ezText("<b>using 'showLines' option - DEPRECATED</b>\n", 10);

    $pdf->ezText("\nDefault: showLines = 1\n", 10);
//esta es la primera tabla
    $pdf->ezTable($data, $cols, "", array('xPos' => 'coordinate','xOrientation' => 'right'));
//esta es la segunda
    $pdf->ezTable($data, $cols, "", array('xPos' => 'right','xOrientation' => 'left')); 
    $pdf->ezStream();
    ?>
    
asked by Kiru 19.04.2016 в 15:17
source

1 answer

0

I tried the code and read the documentation, apparently that library is quite basic, it only supports some html tags, and does not allow more options when creating the table, I recommend using another library, for example TCPDF which gives more customization options by supporting html and css .

For example, in tcpdf you can do something like this to create tables.

$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" border="1">
    <tr>
        <td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
        <td>COL 2 - ROW 1</td>
        <td>COL 3 - ROW 1</td>
    </tr>
    <tr>
        <td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
        <td>COL 3 - ROW 2</td>
    </tr>
    <tr>
       <td>COL 3 - ROW 3</td>
    </tr>

</table>
EOD;

$pdf->writeHTML($tbl, true, false, false, false, '');

In this link is the complete example:

link

And here is the example in PDF:

link

    
answered by 19.04.2016 / 16:57
source