Ver Mensaje Individual
  #12 (permalink)  
Antiguo 07/06/2011, 14:44
patiurco
 
Fecha de Ingreso: mayo-2011
Ubicación: Toluca
Mensajes: 115
Antigüedad: 12 años, 10 meses
Puntos: 2
Respuesta: -Encabezado y pie de pagina con html2pdf???

Si de echo así lo estoy haciendo, ya que tenia un inconveniente haciéndolo por inclusión de archivos, pero no se la sintaxis de un header ni un footer y mucho menos donde colocar el codigo. Mira debajo dejo mi código, porque como te digo no lo estoy haciendo por inclusión:


Código PHP:
Ver original
  1. <?php
  2. require_once('html2pdf/html2pdf.class.php');//Aqui colocamos la ruta en la que esta situada nuetra libreria
  3.    //Cabecera de página
  4. $html2pdf = new HTML2PDF('1','a4','es',false,'ISO-8859-15',array(0, 0, 0, 0));//Aqui declaramos la apertura de nuestro documento
  5. //conexion a la base
  6. $conexion=mysql_connect('localhost','root','')or die("IMPOSIBLE CONECTARSE AL SERVIDOR");
  7. $base=mysql_select_db('aceros_anglo',$conexion)or die("IMPOSIBLE CONECTARSE A LA BASE");
  8. $c="SELECT * FROM productos";
  9. $res=mysql_query($c);
  10. $filas=mysql_num_rows($res);
  11. if ($filas > 0) {
  12. ///******CABECERA******///
  13. $html="<table border='1' bgcolor=#4682B4 align='center'>
  14.            <tr style='text-align:center;background-color:black;color:white;'>
  15.                <td>Clave del producto</td>
  16.                <td>Nombre del producto</td>
  17.                <td>Existencias</td>
  18.                 <td>Fecha de alta</td>
  19.                 <td>Activo</td>
  20.            </tr>";
  21.     while($row=mysql_fetch_array($res)) {
  22.         $nombre=$row['nombre'];
  23.         $idp=$row['idp'];
  24.         $existencia=$row['existencia'];
  25.         $fecha=$row['fecha_alta'];
  26.         $activo=$row['activo'];
  27. $html.="<tr style='text-align:center;background-color:Dimgray;color:white;font-size:10px;'>
  28.            <td>".$idp."</td>
  29.            <td>".$nombre."</td>
  30.            <td>".$existencia."</td>
  31.             <td>".$fecha."</td>
  32.             <td>".$activo."</td>";
  33. $html.= "</tr>";
  34. }
  35. $html.= "</table>";
  36. }
  37. $html2pdf->WriteHTML($html);
  38. $html2pdf->Output('Reporte de productos.pdf','I');
  39. ?>