<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2745.2800" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Using Fedora Core 6 and Samsung SCX-4200 -
</FONT><FONT face=Arial size=2>I need to be able to create files with
dynamic content which I can then print. I am testing the printout mechanisms
that I will need but I am encountering various problems when using
both "lpr", for pdf files, or "ooffice", for odt files. Below is PHP script
which I have used to record the ways I have attempted - most of the
problems appear to be with X-server. All suggestions welcome. Many thanks,
Brendan</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><?php<BR>print "Started
dud_print_pdf.php<br>\n";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>// lpr command for a pdf file<BR>// If I run this
command in a terminal window it works but I am prompted to press an "OK"
button<BR>// When run in program I get error_code -1<BR>//$command = "lpr -# 1
/home/db/support/support_application/dud.pdf";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>// lpr in command script<BR>// Using script
containing the above command......<BR>// If I run this shell script in a
terminal window it works but I am prompted to press an "OK" button<BR>// When
run via this program - gives error code -1<BR>// and the log produced "lpr:
cannot connect to X server"<BR>// I also get this same error if I run the shell
script on the cron queue <BR>//$command = "bash
/home/db/support/support_application/dud.sh";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>// oofice command for odt file <BR>// If I run the
command in a terminal window it works but I am prompted to press an "OK"
button<BR>// When run viA this program it gives error code 0 (i.e. no error) but
no printout appears<BR>//$command = "/usr/bin/ooffice -headless -pt scx4200
/home/bu/belfast/ni_reports/screen_report.odt";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>// ooffice in command script<BR>// Using script
containing the above command......<BR>// If I run this shell script in a
terminal window it works AND I am NOT prompted to press an "OK" button<BR>// If
I run it via a cron job I get:<BR>//Set DISPLAY environment variable, use
-display option<BR>// or check permissions of your
X-Server<BR>// (See "man X" resp. "man xhost" for
details)<BR>$command = "bash
/home/db/support/support_application/dud1.sh";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>print
">>>command>$command<<br>\n";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>$result = exec($command, $output,
$error_code);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>if ($error_code > 0)<BR>{<BR> print
"Unable to execute command - code was
>$error_code<";<BR>}<BR>else<BR>{<BR> print "No error
reported<br>\n";<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>print
"Finished<br>\n";<BR>?><BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT size=2>
<P><FONT face=Arial></FONT></FONT><FONT face=Arial
size=2></FONT> </P></DIV>
<DIV><FONT face=Arial size=2> </FONT></DIV></BODY></HTML>