Saludos..
El codigo es el siguiente.. Lo probe en linux (ubuntu) y en windows xp y me funciona muy bien. pero en mi otro servidor suse no corre. Utilizo fpdf
Código PHP:
define('FPDF_FONTPATH', 'fpdf/font/');
require('fpdf/fpdf.php');
class PDF extends FPDF {
// Page header
function Header()
{
$this->SetFont('Arial', 'B', 15);
$this->SetTextColor(0, 64, 155);
// Title
$this->SetLineWidth(1);
$this->SetDrawColor(0, 0, 64);
$this->Cell(60);
// Line break
$this->Ln(-7);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial', 'I', 8);
// Page number
$this->Cell(0, 10, 'Linea Final ' . $this->PageNo(), 0, 0, 'C');
}
}
//Consulta a la Base de Datos para la generacion del PDF
$consulta = mysql_query("select .........", $link);
$pdf = new PDF('P', 'mm', 'Letter');
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetLeftMargin(30);
$pdf->SetAutoPageBreak(false,0 );
//Arreglo de la Consulta a la Base de Datos
$fila = mysql_fetch_array($consulta);
$pdf->SetFont('Arial', '', 10);
$pdf->SetX(28);
// Se imprime el NIT del exportador ¡
$pdf->Cell(30, 5, 'NOMBRE', 0, 0, 'L');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(60, 5, $fila['ter_raz'], 0, 1, 'L');
$pdf->Ln(1);
$pdf->SetX(28);
// Se imprime La direccion del exportador
$pdf->Cell(30, 5, 'DIRECCION', 0, 0, 'L');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(60, 5, $fila['dir_prod'], 0, 1, 'L');
$pdf->Ln(1);
$pdf->SetX(28);
//Pais del Exportador por defecto COLOMBIA
$pdf->Cell(30, 5, 'PAIS', 0, 0, 'L');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(60, 5, 'COLOMBIA', 0, 1, 'L');
$pdf->Ln(7);
$pdf->SetX(28);
//Nombre del Importador
$pdf->Cell(30, 5, 'NOMBRE', 0, 0, 'L');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(60, 5, $fila['cer_nom_imp'], 0, 1, 'L');
$pdf->Ln(1);
$pdf->SetX(28);
// La direccion del Importador
$pdf->Cell(30, 5, 'DIRECCION', 0, 0, 'L');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(60, 5, $fila['cer_dir_imp'], 0, 0, 'L');
$pdf->Cell(100, 5, 'COLOMBIA', 0, 1, 'C');
//Telefono del Importador
$pdf->Ln(1);
$pdf->SetX(28);
$pdf->Cell(30, 5, 'TELEFONO', 0, 0, 'L');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(60, 5, $fila['cer_tel_imp'], 0, 1, 'L');
//Pais a Exportar
$pdf->Ln(1);
$pdf->SetX(28);
$pdf->Cell(30, 5, 'PAIS', 0, 0, 'L');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(60, 5, $fila['cer_pai_imp'], 0, 0, 'L');
$pdf->Ln(9);
$pdf->SetX(28);
// Medio de Transporte
$pdf->Cell(30, 5, $fila['med_trans'], 0, 0, 'L');
$conlin = 0;
$pdf->SetFont('Arial', '', 10);
$pdf->Ln(65);
$pdf->SetX(26);
$pdf->Cell(6, 5, '01', 0, 0, 'L');
$pdf->SetX(37);
$pdf->Cell(8, 5, 'ITALIA', 0, 0, 'L');
$pdf->SetX(65);
$pdf->Cell(8, 5, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 0, 0, 'L');
$pdf->SetX(145);
$pdf->Cell(8, 5, 'AAAAA', 0, 0, 'L');
$pdf->SetX(170);
$pdf->Cell(8, 5, 'AAAAAAA', 0, 0, 'L');
$pdf->SetX(194);
$pdf->Cell(8, 5, 'AAAAA', 0, 0, 'L');
$pdf->Ln(5);
$pdf->SetX(65);
$pdf->Cell(8, 5, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, 0, 0, 'L');
$pdf->Ln(5);
$pdf->SetX(65);
$pdf->Cell(8, 5, 'Nit:', 0, 0, 'L');
$pdf->Cell(40, 5, CCC, 0, 1, 'C');
$pdf->SetX(65);
$pdf->Cell(8, 5, 'NANDINA:', 0, 0, 'L');
$pdf->Cell(40, 5, DDD, 0, 1, 'C');
$pdf->SetX(65);
$pdf->Cell(8, 5, 'CANTIDAD:', 0, 0, 'L');
$pdf->Cell(40, 5, DDD, 0, 1, 'C');
$pdf->SetX(65);
$pdf->Cell(8, 5, 'Pes.Br:', 0, 0, 'L');
$pdf->Cell(40, 5, DDD, 0, 1, 'C');
$pdf->SetX(65);
$pdf->Cell(8, 5, 'V.FOB:', 0, 0, 'L');
$pdf->Cell(40, 5, EEE, 0, 1, 'C');
$pdf->SetX(15);
$pdf->Ln(92);
$pdf->SetX(120);
$pdf->Cell(105, 5, 'COLOMBIA', 0, 0, 'C');
$pdf->Ln(23);
$pdf->SetX(125);
$pdf->Cell(101, 5, $fila['cer_pai_imp'], 0, 1, 'L');
$pdf->Output();