
Error php
Publicado por Mayra (2 intervenciones) el 25/11/2014 05:55:43
Hola, es la primera vez que escribo aqui pero tengo un pequeño error y ya busque mil formas de modificarlo y no puedo. Espero que alguien logre ayudarme a encontrar una solucion, mi problema es el siguiente: En la siguiente imagen que adjunte aparece el problema, tambien adjuntare el codigo. Nota: Estoy haciendo un pdf con tcpdf


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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
$con=mysql_connect("localhost","root", "tecnologicos");
mysql_select_db("proyectopdf");
session_start();
$nc = $_SESSION['Id'];
$sql = "SELECT * FROM listaalumnos WHERE Id='{$nc}'";
$rs = mysql_query($sql,$con);
$alumno = mysql_fetch_object($rs);
require_once('tcpdf/tcpdf.php');
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header() {
// Logo
$image_file = K_PATH_IMAGES.'arriba.png';
$this->Image($image_file, 10, 10, 190, '', 'png', '', 'T', false, 300, '', false, false, 0, false, false, false);
// Set font
$this->SetFont('helvetica', 'B', 20);
// Title
}
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
// Page number
$this->Cell(0, 10, 'Pagina '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 003');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'N', 12);
// add a page
$pdf->AddPage();
// set some text to print
$html =
"
Villahermosa Tabasco a 20 de noviembre de 2014
CONSTANCIA DE CALIFICACIONES
P R E S E N T E
";
$html2 =
"
El Instituto Tecnologico de Villahermosa hace constar que el(la) C. {$alumno->Nombre} {$alumno->Apellidopaterno} {$alumno->Apellidomaterno}
con numero de control {$alumno->Numerocontrol} de la carrera {$alumno->Carrera} el cual concluyo la materia {$alumno->Materia},
con fecha hasta el dia {$alumno->Fecha}.
";
// NON-BREAKING TABLE (nobr="true")
$tbl = <<<EOD
<table border="1" cellpadding="1" cellpadding="1" cellpadding="1" cellspacing="1" nobr="true">
<tr>
<th colspan="5" align="center">Datos de la constancia</th>
</tr>
<tr>
<td align="center">Matricula</td>
<td align="center">Nombre</td>
<td align="center">Materia</td>
<td align="center">Carrera</td>
<td align="center">Fecha</td>
</tr>
<tr>
<td>{$alumno->Numerocontrol}</td>
<td>{$alumno->Nombre} {$alum->Apellidopaterno} {$alumno->Apellidomaterno}</td>
<td>{$alumno->Materia}</td>
<td>{$alumno->Fecha}</td>
</tr>
</table>
EOD;
$html3 =
"
Sin otro particular le envio un cordial saludo.
Atentamente
_________________________________________________________________
{$alumno->Nombre} {$alumno->Apellidopaterno} {$alumno->Apellidomaterno}
";
// print a block of text using Write()
$pdf->Write(0, $html, '', 0, 'J', true, 0, false, false, 0);
$pdf->Write(0, $html2, '', 0, 'J', true, 0, false, false, 0);
$pdf->writeHTML($tbl, true, false, false, false, '');
$pdf->Write(0, $html3, '', 0, 'C', true, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('constancia.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Valora esta pregunta


0