Note that there are some explanatory texts on larger screens.

plurals
  1. POFpdf table in more than one page
    primarykey
    data
    text
    <p>I am trying to construct a PDF table with fPDF and PHP and it creates a table if it fits one page. However if the table does not fit in one page, although the first page is good, on the second page and on the other pages the table is not regular. Here is an example of my pdf output:</p> <p><a href="https://rapidshare.com/files/486723233/results.pdf" rel="nofollow">https://rapidshare.com/files/486723233/results.pdf</a></p> <p>And here is my code for create this table:</p> <pre><code>//FILL THE TABLE $max_number_of_lines = 0; for ($index = 0; $index &lt; count($subjects); $index++,$temp=0,$row_height = 15,$max_number_of_lines = 0) { //Account height of row, all will be same //Issue a page break first if needed if($this-&gt;GetY()+$row_height &gt; $this-&gt;PageBreakTrigger) $this-&gt;AddPage($this-&gt;CurOrientation); foreach ($subjects[$index] as $fields) { $myString = mb_convert_encoding($fields, "iso-8859-9", "auto"); $number_of_lines = ceil(($this-&gt;GetStringWidth($fields))/$fieldLengthArray[$temp]); if ($row_height &lt; ceil($number_of_lines * 15)) { $row_height = ceil($number_of_lines * 15); $max_number_of_lines = $number_of_lines+1; } $temp++; } $temp=0; foreach ($subjects[$index] as $myFields) { //$this-&gt;SetAutoPageBreak(true,$row_height); $this-&gt;SetY($currentY); $this-&gt;SetX($currentX); $myString = mb_convert_encoding($myFields, "iso-8859-9", "auto"); $number_of_lines = ceil(($this-&gt;GetStringWidth($myFields))/$fieldLengthArray[$temp]); if ($number_of_lines &lt; $max_number_of_lines-1) { $this-&gt;Rect($currentX, $currentY, $fieldLengthArray[$temp], $row_height); //Draw the border //$this-&gt;Rect($x, $y, $w, $h); $this-&gt;MultiCell($fieldLengthArray[$temp], ceil($row_height/$max_number_of_lines) , $myString,0, 'L', $fill); } else { //Draw the border //$this-&gt;Rect($x, $y, $w, $h); $this-&gt;Rect($currentX, $currentY, $fieldLengthArray[$temp], $row_height); $this-&gt;MultiCell($fieldLengthArray[$temp], ceil($row_height/$max_number_of_lines), $myString,0, 'L', $fill); } $currentX += $fieldLengthArray[$temp]; $temp++; //$this-&gt;Ln(); } $this-&gt;Ln($row_height); $this-&gt;SetY($currentY); $currentX = $this-&gt;GetX(); $currentY += $row_height; } $this-&gt;SetFillColor(238); $this-&gt;SetLineWidth(0.2); $this-&gt;SetFont('arial_tr', '', 10); $this-&gt;Ln(); } </code></pre> <p>It is part of my function, Generate table and <code>$subjects</code> is the information i get from database. </p> <pre><code>$subjects = array(array()) </code></pre> <p>I couldn't understand why it is not regular in the second and other pages when it is regular on first page. I also check for end of the page.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload