aqui el codigo
Código PHP:
<?
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_begin_page($pdf, 595, 842);
include("conexion.php");
$link=Conectarse();
$sql1=mysql_query("select distinct area,partida,total,capitulo from temp_paa",$link);
$y=570;
while($row1=mysql_fetch_array($sql1))
{
$id_depto1=$row1[id_depto];
$area1=$row1[area];
$capitulo1=$row1[capitulo];
$partida1=$row1[partida];
$total1=$row1[total];
$total_f=number_format($total1,"2",".",",");
pdf_set_font($pdf, "Times-Bold", 10,"host", 0 );
pdf_show_xy($pdf,"$area1",40,$y);
pdf_show_xy($pdf,"$partida1",275,$y);
if($capitulo1=="2000")
{
pdf_show_xy($pdf,"$ $total_f",320,$y);
$y=$y-15;
}
if($capitulo1=="3000")
{
pdf_show_xy($pdf,"$ $total_f",400,$y);
$y=$y-15;
}
if($capitulo1=="5000")
{
pdf_show_xy($pdf,"$ $total_f",520,$y);
$y=$y-15;
}
}
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=test.pdf");
header("Content-length: " . strlen($data)); // desplegar los datos del buffer como PDF
echo $data;
?>