رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
مشکل در خروجی pdf با استفاده از dompdf
#1
سلام
من dompdf  رو دانلود کردم و طبق آموزش یک فایل جهت خروجی pdf ساختم :
کدها :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
  require_once("dompdf/autoload.inc.php");
 include("dompdf/src/Dompdf.php");
 $conexion=mysql_connect("localhost","root","");
 mysql_select_db("school",$conexion);
 
 
$codigoHTML='
<!doctype html>
<html>
<head>
    
   <!-- Meta -->
       <meta charset="utf-8">
       <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
       <meta name="viewport" content="width=device-width, initial-scale=1">
       <title>Convert to Excel,...</title>
   <!-- Meta -->
    
</head>    
<body>
   <table width="100%" cellspacing="" cellpadding="">
       <tr>
           <td colspan="6">Bingo</td>
       </tr>
       <tr bgcolor="blue">
           <td>row</td>
           <td>name</td>
           <td>family</td>
       </tr>';
  
     $sql=mysql_query("select * from student");  
       while($res=mysql_fetch_array($sql)){
           $codigoHTML.='
           <tr>
               <td>'.$res['s_id'].'</td>
               <td>'.$res['s_name'].'</td>
               <td>'.$res['s_family'].'</td>
           </tr>';
       }
        
 
$codigoHTML.='    
</table>
</body>    
    
    
</html> ';
$codigoHTML=utf8_encode($codigoHTML);
$dompdf=new DOMPDF();
$dompdf->load_html($codigoHTML);
ini_set("memory_limit","128M");
$dompdf->render();
$dompdf->stream("Reporte_table_usuarios.pdf");
 
?>

خطا:
کد:
Fatal error: Class 'DOMPDF' not found in C:\xampp\htdocs\Test\reporte_pdf.php on line 50
[عکس: joomlaforum.ir_14704086511.png]
پاسخ
تشکر شده توسط:
#2
(15-05-1395، 07:21 ب.ظ)پیام حیاتی نوشته: سلام
من dompdf  رو دانلود کردم و طبق آموزش یک فایل جهت خروجی pdf ساختم :
کدها :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
  require_once("dompdf/autoload.inc.php");
 include("dompdf/src/Dompdf.php");
 $conexion=mysql_connect("localhost","root","");
 mysql_select_db("school",$conexion);
 
 
$codigoHTML='
<!doctype html>
<html>
<head>
    
   <!-- Meta -->
       <meta charset="utf-8">
       <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
       <meta name="viewport" content="width=device-width, initial-scale=1">
       <title>Convert to Excel,...</title>
   <!-- Meta -->
    
</head>    
<body>
   <table width="100%" cellspacing="" cellpadding="">
       <tr>
           <td colspan="6">Bingo</td>
       </tr>
       <tr bgcolor="blue">
           <td>row</td>
           <td>name</td>
           <td>family</td>
       </tr>';
  
     $sql=mysql_query("select * from student");  
       while($res=mysql_fetch_array($sql)){
           $codigoHTML.='
           <tr>
               <td>'.$res['s_id'].'</td>
               <td>'.$res['s_name'].'</td>
               <td>'.$res['s_family'].'</td>
           </tr>';
       }
        
 
$codigoHTML.='    
</table>
</body>    
    
    
</html> ';
$codigoHTML=utf8_encode($codigoHTML);
$dompdf=new DOMPDF();
$dompdf->load_html($codigoHTML);
ini_set("memory_limit","128M");
$dompdf->render();
$dompdf->stream("Reporte_table_usuarios.pdf");
 
?>

خطا:
کد:
Fatal error: Class 'DOMPDF' not found in C:\xampp\htdocs\Test\reporte_pdf.php on line 50
[عکس: joomlaforum.ir_14704086511.png]

سلام
باید از use استفاده کنی
1
2
3
4
5
6
7
8
9
10
<?php
// include autoloader
require_once 'dompdf/autoload.inc.php';
 
// reference the Dompdf namespace
use DompdfDompdf;
 
// instantiate and use the dompdf class
$dompdf = new Dompdf();
?>
پاسخ
تشکر شده توسط:




کاربران در حال بازدید این موضوع: