Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/02/2015, 08:57
gigasize777
 
Fecha de Ingreso: febrero-2015
Mensajes: 9
Antigüedad: 9 años, 2 meses
Puntos: 0
Respuesta: como pasar php a pdf

Cita:
Iniciado por hhs Ver Mensaje
Y luego ? en ninguna parte veo que estés usando alguna de las herramientas que mencionas... o espera no estarás pensando en que alguien mas lo haga verdad ??
aqui el codigo usando dompdf y no me sirve:

Código PHP:
Ver original
  1. <?php
  2. $html =
  3.  
  4.        $con = mysql_connect('localhost', 'root', '123456') or die('ERROR DE CONEXION CON MYSQL: ' . mysql_error());
  5.        mysql_select_db('libros', $con) or die('ERROR CONEXION CON BD: '.mysql_error());
  6.      
  7.        $result = mysql_query('SELECT Titulo, Autor, Editorial, Año as Year FROM libros');
  8.      
  9.        ?>
  10.     <body style="background-color: #f4f4f4">
  11.        <table border="1">
  12.      
  13.        <th>Titulo</th>
  14.        <th>Autor</th>
  15.        <th>Editorial</th>
  16.        <th>Año</th>
  17.      
  18.        <?php
  19.        while ($r = mysql_fetch_object($result))
  20.        {
  21.        echo '<tr>';
  22.        echo '<td>'. $r->Titulo . '</td>';
  23.        echo '<td>'. $r->Autor . '</td>';
  24.        echo '<td>'. $r->Editorial . '</td>';
  25.        echo '<td>'. $r->Year . '</td>';
  26.        echo '</tr>';
  27.        }
  28. $dompdf = new DOMPDF();
  29. $dompdf->load_html($html);
  30. $dompdf->render();
  31. $dompdf->stream("archivo.pdf");
  32.  
  33.        ?>
  34.        </table>