title: When using Magento, PDF cuts off after first page
body: <p>Using Magento with Zend_Pdf and a couple of custom classes that allow for the printing/downloading of PDFs with certain header/table specifications.  The problem is that it cuts off after the first page and doesn't create a new page when the items list is more than about 20 items.  </p>
  
  <p>This code:  </p>
  
  <pre><code>public function getOutput()
  {
  
  $this-&gt;pages[] = $this-&gt;page;
  
  return $this-&gt;render();
  
  }
  </code></pre>
  
  <p>And this code:</p>
  
  <pre><code>$pdf = new PrintPdf();
  $pdf-&gt;generate($sourceData);
  $output = $pdf-&gt;getOutput();
  
  echo $output;
  </code></pre>
  
  <p>Are where I believe the error is happening in.  If I change the "return" in the first code to "echo" it will output the correct data to the browser, but when I then try and pass it through the second code, it only puts out one page of data.  </p>
  
  <p>Any advice would be appreciated as I have been working on this for about 2 weeks.</p>
  
  <p>UPDATE:</p>
  
  <p>I was told this piece of code: </p>
  
  <pre><code>private function drawLineItems($tableData)
      {
          $this-&gt;drawHeading($this-&gt;__('Line Items'));
  
          // Draw table
          $this-&gt;decOffset(35);
          $this-&gt;colorLine(cBLUE);
          $this-&gt;page-&gt;setLineWidth(0.5);
          $this-&gt;page-&gt;drawLine($this-&gt;pMargin, $this-&gt;yOffset, $this-&gt;pWidth - $this-&gt;pMargin, $this-&gt;yOffset);
  
          $this-&gt;fontSize(FONT_SMALL);
          $this-&gt;colorFill(cBLUE);
  
          $this-&gt;decOffset(15);
  
          $sum = ($this-&gt;pMargin + 10);
          for($idx = 0; $idx &lt; sizeof($tableData['heading']); $idx++) {
              $pos = $sum;
              $this-&gt;page-&gt;drawText($tableData['heading'][$idx], $sum, $this-&gt;yOffset);
              $sum += ($tableData['width'][$idx] + 10);
              $tableData['width'][$idx] = $pos;
          }
  
          $this-&gt;decOffset(10);
          $this-&gt;page-&gt;drawLine($this-&gt;pMargin, $this-&gt;yOffset, $this-&gt;pWidth - $this-&gt;pMargin, $this-&gt;yOffset);
  
          $this-&gt;fontSize(8);
          $this-&gt;colorFill(cLIGHT);
          $this-&gt;colorLine(cBORDER);
  
          foreach($tableData['rows'] as $row) {
              $this-&gt;decOffset(15);
  
              $yOffset = $this-&gt;yOffset;
  
              for($idx = 0; $idx &lt; sizeof($row); $idx++) {
                  if ($tableData['heading'][$idx] == 'Description') {
                      $lines = $this-&gt;_breakTextToLines($row[$idx], $tableData['width'][$idx + 1] - $tableData['width'][$idx]);
                      foreach ($lines as $line) {
                          $this-&gt;page-&gt;drawText($line, $tableData['width'][$idx], $yOffset);
                          $yOffset -= 10;
                      }
                  } else {
                      $this-&gt;page-&gt;drawText($row[$idx], $tableData['width'][$idx], $this-&gt;yOffset);
                  }
              }
              $this-&gt;decOffset($this-&gt;yOffset - $yOffset);
              $this-&gt;page-&gt;drawLine($this-&gt;pMargin, $this-&gt;yOffset, $this-&gt;pWidth - $this-&gt;pMargin, $this-&gt;yOffset);
          }
  
          $this-&gt;decOffset(20);
          $this-&gt;fontSize(FONT_NORMAL);
          $this-&gt;colorFill(cDARK);
          $this-&gt;page-&gt;drawText($this-&gt;__('Grand Total') . ': ' . $tableData['total'], $this-&gt;pWidth - 125, $this-&gt;yOffset);
      }
  </code></pre>
  
  <p>is probably where the problem is as it doesn't form a new page after a certain number of items.  My problem now lies in accomplishing this task.  Help would still be appreciated.</p>