Here is your script debugged but I don't know if is doing what
is supposed to do ....
From now you have to see if the logical part is all
right.
I don't have a printer on my computer right now so I cannot
teste him very well.
>
Hi guys...I'm in trouble again...see if you can help me... > I get the
following error when I run the following script. > Let me try to explain
the code. I'm writing some code for an intranet web > page, I'm want to
print to a printer some text but I'm wanted to be printed > centered.
If the text exceed the 20 characters the line need to be splited > up in
2 lines...an so on... > > The error that I get is the
following: > > Fatal error: Maximum execution time of 60 seconds
exceeded in c:\archivos de > programa\apache
group\apache\htdocs\printer.php on line 116 > > The line error is
marked with ****** > > Here is the code: > >
<? > > $i=20; > $handle = printer_open(); > print
printer_get_option($handle, PRINTER_PAPER_FORMAT); > $vardumped=
printer_get_option($handle, PRINTER_PAPER_WIDTH); > $vardumped1=
printer_get_option($handle, PRINTER_PAPER_LENGTH); >
printer_set_option($handle, PRINTER_PAPER_FORMAT,
PRINTER_FORMAT_LEGAL); > PRINT "$vardumped<BR>"; > PRINT
"$vardumped1<BR>"; > $var1= printer_get_option($handle,
PRINTER_PAPER_FORMAT); > $var2= printer_get_option($handle,
PRINTER_PAPER_WIDTH); > $var3= printer_get_option($handle,
PRINTER_PAPER_LENGTH); > PRINT "$var1<BR>"; > PRINT
"$var2<BR>"; > PRINT "$var3<BR>"; >
printer_start_doc($handle, "My Document"); >
printer_start_page($handle); > > $pen =
printer_create_pen(PRINTER_PEN_SOLID, 30, "000000"); >
printer_select_pen($handle, $pen); > > >
$text_asunto="ASUNTO N°: "; > > $asunto="ALEJANDRO CESAR
GARRAMMONE SUPUESTO"; /*max 20*/ > $len=strlen($asunto); > IF
($len<=20): > SWITCH($len): > case
20: > printer_select_font($handle, $font5);
/*50*/ > printer_draw_text($handle, "$asunto", 500,
2800); > break; > case
19: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 500,
2800); > break; > case
18: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 750,
2800); > break; > case
17: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 750,
2800); > break; > case
16: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 850,
2800); > break; > case
15: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 950,
2800); > break; > case
14: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 950,
2800); > break; > case
13: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1050,
2800); > break; > case
12: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1250,
2800); > break; > case
11: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1350,
2800); > break; > case
10: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1400,
2800); > break; > case
9: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1400,
2800); > break; > case
8: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1500,
2800); > break; /*100*/ > case
7: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1700,
2800); > break; > case
6: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 1800,
2800); > break; > case
5: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 2000,
2800); > break; > case
4: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 2100,
2800); > break; > case
3: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 2200,
2800); > break; > case
2: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 2300,
2800); > break; > case
1: > printer_select_font($handle,
$font5); > printer_draw_text($handle, "$asunto", 2300,
2800); > break; > ENDSWITCH; >
/*130*/ > ENDIF; > > IF ($len<=41): >
WHILE ($i<>0): > IF ($asunto[$i]=="
"): *************This is line
116 >
$corte1=$i; > $i=0; >
ENDIF; > $i=$i + 1; >
ENDWHILE; > $i=$corte1 + 20; > IF
($i>=$len): > $i=$len; >
ENDIF; > > WHILE
($i<>$corte1): > IF($asunto[$i]=="
"): >
$corte2=$i; >
$i=$corte1; > ENDIF; > $i= $i
+ 1; > ENDWHILE; > > ENDIF; >
$j=0; > WHILE ($j==$corte1): > $asunto_p1="$asunto_p1" .
$asunto[$j]; > $j = $j + 1; > ENDWHILE; >
$j=$corte1; > WHILE ($j==$corte2): > $asunto_p2="$asunto_p2"
. $asunto[$j]; > $j = $j + 1; >
ENDWHILE; > > > > > > > >
$font = printer_create_font("Times New Roman", 110, 55,
PRINTER_FW_BOLD, > TRUE, FALSE, FALSE, 0); >
printer_select_font($handle, $font); > printer_draw_text($handle,
"Ministerio Público", 1850, 1500); > printer_draw_text($handle, "Unidad
Fiscal de Investigación de Delitos > Tributarios y Contrabando", 650,
1650); > printer_draw_text($handle, "UFITCO", 2050, 1800); >
$font1=printer_create_font("Times New Roman", 143, 76,
PRINTER_FW_BOLD, > FALSE, TRUE, FALSE, 0); >
printer_select_font($handle, $font1); > printer_draw_text($handle,
"$text_asunto", 500, 2100); > $font2=printer_create_font("Times New
Roman", 143, 76, PRINTER_FW_BOLD, > FALSE, FALSE, FALSE, 0); >
printer_select_font($handle, $font2); > printer_draw_text($handle,
"$junta", 1400, 2100); > $font3=printer_create_font("Times New Roman",
138, 70, PRINTER_FW_BOLD, > FALSE, TRUE, FALSE, 0); >
$font4=printer_create_font("Times New Roman", 138, 70,
PRINTER_FW_BOLD, > FALSE, FALSE, FALSE, 0); >
printer_select_font($handle, $font3); > printer_draw_text($handle,
"INVESTIGACIÓN PRELIMINAR N°: ", 500, 2400); >
printer_select_font($handle, $font4); > printer_draw_text($handle,
"$inv_prel1", 2850, 2350); > $font5=printer_create_font("Times New
Roman", 220, 83, PRINTER_FW_NORMAL, > FALSE, FALSE, FALSE,0); >
$font6=printer_create_font("Times New Roman", 120, 62,
PRINTER_FW_BOLD, > FALSE, FALSE, FALSE,0); > >
printer_select_font($handle, $font5); > printer_draw_text($handle,
"$asunto_p1", 1050, 2800); > printer_draw_text($handle, "$asunto_p2",
1050, 3100); > printer_draw_text($handle, "$corte3", 1050,
3400); > > > printer_select_font($handle, $font6); >
printer_draw_text($handle, "Fecha de Recepción en la UFITCO:
$fecha_as1", > 500, 4000); > printer_draw_text($handle,
"Secretaria: $sec_a_cargo1", 500, 4300); > printer_draw_text($handle,
"Responsable: $responsable1", 500, 4600); > printer_draw_text($handle,
"Observaciones:", 500, 4900); > printer_draw_line($handle, 1600, 5000,
4500, 5000); > printer_draw_line($handle, 500, 5300, 4500,
5300); > printer_draw_line($handle, 500, 5600, 4500, 5600); >
printer_draw_line($handle, 500, 5900, 4500, 5900); >
printer_draw_line($handle, 500, 6200, 4500, 6200); >
printer_draw_text($handle, "Juzgado N°: 5", 2850, 6500); >
printer_draw_text($handle, "Secretaría N°: 10", 2850, 6800); >
printer_draw_text($handle, "Fiscalía N°: 6", 2850,
7100); > > > > printer_draw_bmp($handle,
"c:\\escudo.bmp", 2000, 540); > > > >
printer_delete_pen($pen); > > printer_end_page($handle); >
printer_end_doc($handle); >
printer_close($handle); > > > ?> > >
<HTML> > <HEAD> > <meta name="Microsoft Theme"
content="indust 011"> > </head> > <BODY
background="" bgcolor="#FFFFFF" text="#000000" >
link="#3366CC" vlink="#666666" alink="#996600"> >
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"> >
<CENTER><P><i><b><font
color="#0000FF"></center> > <center> <font
size="3"> > </font><br> > <FORM
ACTION="" METHOD="POST"> > <? $submit="True";
?> > <INPUT TYPE="hidden" NAME="submit" VALUE="<? echo $submit
?>"> > <P> > <INPUT TYPE="hidden" NAME="usuario"
VALUE="<? echo $usuario ?>"> > <P> > <INPUT
TYPE="hidden" NAME="passwrd" VALUE="<? echo $passwrd ?>"> >
<P> > > <CENTER><INPUT TYPE="submit" name="submit"
VALUE="Insertar otra > Denuncia"></CENTER> > >
</FORM></CENTER> > >
</TD></TR></TABLE> > <!--mstheme--><font
face="Trebuchet MS, Arial, Helvetica"> > <br> >
<center> <font size="3"> > </font><br> >
<a href="">Salir y volver a la pagina principal de >
Asuntos.</a><BR> > <a href="">Salir y volver
a la pagina principal.</a> > </center> > >
<!--mstheme--></font> > > </BODY> >
</HTML> >
|