Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] fatal error con DOMPDF

Estas en el tema de fatal error con DOMPDF en el foro de PHP en Foros del Web. holiss!! genero mis pdf con la ayuda de DOMPDF todo funciona de maravilla en local host pero cuando subo mi pagina a un servidor me ...
  #1 (permalink)  
Antiguo 23/07/2014, 08:30
 
Fecha de Ingreso: julio-2014
Mensajes: 8
Antigüedad: 9 años, 9 meses
Puntos: 0
Pregunta fatal error con DOMPDF

holiss!!

genero mis pdf con la ayuda de DOMPDF todo funciona de maravilla en local host pero cuando subo mi pagina a un servidor me marca este error:

Fatal error: require_once(): Failed opening required '/dompdf/dompdf_config.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/integrac/public_html/imppdf.php on line 18

la verdad ya estuve investigando por todos lados y nada

les agradeceria mucho su ayuda

estoy desesperada!!!
  #2 (permalink)  
Antiguo 23/07/2014, 09:06
 
Fecha de Ingreso: agosto-2013
Ubicación: Guatemala
Mensajes: 137
Antigüedad: 10 años, 8 meses
Puntos: 4
Respuesta: fatal error con DOMPDF

Me parece que tu error es porque está mal direccionada tu libreria, si compartes tu codigo quizas podriamos resolverlo
  #3 (permalink)  
Antiguo 23/07/2014, 10:22
Avatar de Patriarka  
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 13 años, 3 meses
Puntos: 288
Respuesta: fatal error con DOMPDF

usa paths absolutos, en general las librerias de pdf en php tienen ese problema
  #4 (permalink)  
Antiguo 24/07/2014, 07:23
 
Fecha de Ingreso: julio-2014
Mensajes: 8
Antigüedad: 9 años, 9 meses
Puntos: 0
Respuesta: fatal error con DOMPDF

hey gracias por contestar tan rapido y mi codigo es este:
Código PHP:
Ver original
  1. <?php
  2.     require_once("/dompdf/dompdf_config.inc.php");
  3.     include_once("php_conexion.php");
  4.     $nombreOrganizacion=$_SESSION['nombre'];
  5.     $clave=$_SESSION['clave'];
  6.     $pas=$_SESSION['pass'];
  7.     list($pas,$extencion1) = explode(".",$pas);
  8.     if(isset($_POST['almacenar1'])){
  9.         $rs = mysql_query("SELECT MAX(num) AS id FROM num");
  10.         if ($row = mysql_fetch_row($rs)) {
  11.             $id = trim($row[0]);
  12.             $id++;
  13.         }
  14.          
  15.          $sql = "INSERT INTO `num`(`num`) VALUES ($id)";
  16.         $query = mysql_query($sql);
  17.     }
  18.  /*function Footer()
  19.         {
  20.             //Posición: a 1,5 cm del final
  21.             $this->SetY(-15);
  22.             //Arial italic 8
  23.             $this->SetFont('Arial','I',8);
  24.             //Número de página
  25.             $this->Cell(0,10,'Pagina '.$this->PageNo().'/{nb}',0,0,'C');
  26.         }*/
  27.  
  28.  
  29.     $rs = mysql_query("SELECT MAX(num) AS id FROM num");
  30.     $row = mysql_fetch_assoc($rs);
  31.     $id = $row['id'];
  32.  
  33.     $sql="SELECT `carrito`.clave,`producto`.descripcion,`producto`.unidad,`producto`.precio,`carrito`.cantidad FROM `carrito` inner join `producto` on `carrito`.clave=`producto`.clave";
  34.      
  35.     $marca='Lovato';
  36.     $neto=0;
  37.    
  38.     $result = mysql_query($sql);
  39.  
  40.     $html = '<html><head></head>
  41.             <body  style="font-size:11px; font-family:Arial, Helvetica, sans-serif;">
  42.                 <div align="center" style=" margin-left:59px; position:absolute;left:60px;top:120px;width:400px;height:55px;z-index:8;"><i><h1 id="fuente1" style="color:#f55616; align:center;">Integra Control y seguridad</h1></i></div><br/>
  43.                 <h3>Numero de cotizacion <font size ="12px", color ="red">'.$id.'</font></h3>
  44.                 <h3>Cliente:'.$nombreOrganizacion.'</h3>
  45.                 <div align="center" style=" margin-top:20px; margin-left:15px;">
  46.                 <table>';
  47.     $html .= '<tr ><th bgcolor="#DCDCDC" >Clave</th><th bgcolor="#DCDCDC">Descripcion</th><th bgcolor="#DCDCDC">Unidad de Empaque</th><th bgcolor="#DCDCDC">Marca</th><th bgcolor="#DCDCDC">Existencias</th><th bgcolor="#DCDCDC">Precio</th><th bgcolor="#DCDCDC">Cantidad</th><th bgcolor="#DCDCDC">Subtotal</th>';
  48.  
  49.     $html .= '</tr>';
  50.  
  51.     while ($row = mysql_fetch_array($result)) {
  52.         $total=$row['precio']*$row['cantidad'];#cantidad * valor unitario
  53.         //$neto=$neto+$total;#acumulamos el neto
  54.         $marca="Lovato";
  55.         $totalito=$neto;
  56.         $clave=$row[0];
  57.         $bgcolor="";
  58.         if($extencion1=="D"){
  59.             //$precio=$row['precio']*0.95;
  60.              $neto=$neto+($total*0.90);
  61.              $numero= number_format($neto, 2, '.', '');
  62.         }
  63.         else{
  64.             if($extencion1=="F"){
  65.                  $neto=$neto+$total*1.00;#acumulamos el neto
  66.                  $numero= number_format($neto, 2, '.', '');
  67.             }
  68.             else {
  69.                 if($extencion1=="I"){
  70.                     $neto=$neto+$total*0.85;#acumulamos el neto
  71.                     $numero= number_format($neto, 2, '.', '');
  72.                 }
  73.                 else{
  74.                     if($extencion1=="R"){
  75.                         $neto=$neto+$total*0.95;#acumulamos el neto
  76.                         $numero= number_format($neto, 2, '.', '');                           
  77.                     }
  78.                     else{
  79.                         $neto=$neto+$total;#acumulamos el neto 
  80.                         $numero= number_format($neto, 2, '.', '');
  81.                     }
  82.                 }
  83.             }
  84.         }
  85.                
  86.                
  87.                
  88.         if($bgcolor == '#AFEEEE') $bgcolor = '#C2FF92';
  89.         else $bgcolor = '#AFEEEE';
  90.         $html .= '<tr bgcolor='.$bgcolor.'><td>'.$row['clave'].'</td><td>'.$row['descripcion'].' </td><td>'.$row['unidad'].'</td><td>'.$marca.'</td><td></td><td> $'.$row['precio'].'</td> <td>'.$row['cantidad'].'</td><td> $'.$total.'</td>';
  91.  
  92.         $html .= '</tr>';
  93.  
  94.     }
  95.     $html .='<tr align="center"><th  bgcolor="#DCDCDC">TOTAL</th>';
  96.     $html .='<tr align="center"><td bgcolor='.$bgcolor.'><font size ="3", color ="red">$'.$numero.'</font></td></tr>';
  97.     $html .= '</table> </div>
  98.  
  99.  
  100.             <div style="position:absolute; margin-top:410px;" >Senda de los Recuerdos No.485<br>Fracc. Milenio C.P. 76209</br> Queretaro, Qro, M&eacute;xico</br>Tel&eacute;fonos: (442) 1611587 </div>
  101.  
  102.             Copyright &copy; 2014 Todos los Derechos reservados
  103.  
  104.  
  105.         </body>
  106.  
  107.  
  108.  
  109.         </html>' ;
  110.  
  111.  
  112.  
  113.  
  114.  
  115.     $dompdf = new DOMPDF();
  116.     $dompdf->load_html($html);
  117.     $dompdf->render();
  118.     $nombre_archivo="Cotizacion";
  119.     //$secuenciadompdf-> ($nombre_archivo, array ('Anexo' => 0));
  120.     //$dompdf->output();
  121.     //$pdf=$dompdf->stream($nombre_archivo);//metodo para descargar pdf
  122.  
  123.     header('Content-type: application/pdf');
  124.     echo $dompdf->output(); // mandar a imprimir en pantalla el pdf
  125.  
  126. ?>
  #5 (permalink)  
Antiguo 29/07/2014, 07:58
 
Fecha de Ingreso: julio-2014
Mensajes: 8
Antigüedad: 9 años, 9 meses
Puntos: 0
Respuesta: fatal error con DOMPDF

bueno ya resolví mi problema xD muchas gracias por su ayuda :D
la solucion que utilice fue la siguiente:
Código PHP:
Ver original
  1. // directorio en donde buscar el script pdf.php
  2. $dir = dirname(__FILE__);
  3. // Toma el contenido de pdf para despues
  4. require_once($dir.'/imppdf.php');
  5. $pdf_html = ob_get_contents();
  6. // carga dompdf
  7. require_once($dir.'/dompdf/dompdf_config.inc.php');
  #6 (permalink)  
Antiguo 29/07/2014, 08:33
Avatar de Patriarka  
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 13 años, 3 meses
Puntos: 288
Respuesta: fatal error con DOMPDF

paths absolutos!
esa solucion no es para todas las versiones de php
  #7 (permalink)  
Antiguo 06/08/2014, 10:42
 
Fecha de Ingreso: julio-2014
Mensajes: 8
Antigüedad: 9 años, 9 meses
Puntos: 0
Respuesta: fatal error con DOMPDF

Cita:
Iniciado por Patriarka Ver Mensaje
paths absolutos!
esa solucion no es para todas las versiones de php
Pues a mi me funciono de maravilla

Etiquetas: dompdf, fatal, html
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:43.