views:

543

answers:

1

Here is an example of my problem: http://idea-palette.com/pdf/

I'm using FPDF to write some text on a PDF. I'm displaying 8 different cells of text. The Cells are being displayed, but after two cells, it puts the next cell onto a new page as If I had asked for a new PDF page to be made, but I did not. I'm guessing it is somehow pushing them down and pushing it onto the next page. How can I get rid of these annoying spaces and make it all fit on only the one PDF page?

I am using the FPDF Class - http://fpdf.org/en/doc/index.php

Here's my code:

<?php
// Get required files.
require 'fpdf/fpdf.php';

// Set some document variables
$author = "Me McMe";
$company_name = "APPLIED MATERIALS";
$name = "Liang Y. Chen, Ph.D.";
$title = "Corporate Vice President & General Manager";
$title_2 = "Alternative Energy Products Group";
$dept_div = "Energy & Environmental Solutions";
$phone = "T  408.563.6330";
$fax = "F  408.235.6989";
$email = "[email protected]";
$address2 = '3535 Garrett Drive, M/S 10071fdsfsdf';

// Create fpdf object
$pdf = new FPDF('L', 'mm', array(51,87)); //fpdf(orientation(L for Landscape), unit of measurement(mm for millimeters), 

// Add a new page to the document
$pdf->addPage('L', array(51,87));

$pdf->SetDisplayMode(real,'two');
$pdf->SetFont('Arial','B',5);
$pdf->SetTextColor(0,0,0); 
$pdf->SetXY(0, 0);
$pdf->SetMargins(0,0,0);

$pdf->Cell(0,11, "$company_name", '1', 2, 'L', false);
$pdf->Cell(0,11, "$name", '1', 2, 'L', false);
$pdf->Cell(0,11, "$title", '1', 2, 'L', false);
$pdf->Cell(0,11, "$title_2", '1', 2, 'L', false);
$pdf->Cell(0,11, "$dept_div", '1', 2, 'L', false);
$pdf->Cell(0,11, "$phone", '1', 2, 'L', false);
$pdf->Cell(0,11, "$fax", '1', 2, 'L', false);
$pdf->Cell(0,11, "$email", '1', 2, 'L', false);
$pdf->Cell(0,11, "$address2", '1', 2, 'L', false);

$pdf->Image('amatlogo.gif', 0, 0, 23.28, 21.52, 'GIF');
$pdf->Output('simple.pdf','I');
?>
+2  A: 

look at

SetAutoPageBreak(boolean auto [, float margin])

Description Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.

Sabeen Malik
yup! That was it. Thank you!
zeckdude