[Sussex] Printing problems

Brendan Whelan b_whelan at mistral.co.uk
Mon Aug 13 11:54:51 UTC 2007


Using Fedora Core 6 and Samsung SCX-4200 -  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

<?php
print "Started dud_print_pdf.php<br>\n";

// lpr command for a pdf file
// If I run this command in a terminal window it works but I am prompted to press an "OK" button
// When run in program I get error_code -1
//$command = "lpr -# 1 /home/db/support/support_application/dud.pdf";

// lpr in command script
// Using script containing the above command......
// If I run this shell script in a terminal window it works but I am prompted to press an "OK" button
// When run via this program - gives error code -1
// and the log produced "lpr: cannot connect to X server"
// I also get this same error if I run the shell script on the cron queue 
//$command = "bash /home/db/support/support_application/dud.sh";

// oofice command for odt file 
// If I run the command in a terminal window it works but I am prompted to press an "OK" button
// When run viA this program it gives error code 0 (i.e. no error) but no printout appears
//$command = "/usr/bin/ooffice -headless -pt scx4200 /home/bu/belfast/ni_reports/screen_report.odt";

// ooffice in command script
// Using script containing the above command......
// If I run this shell script in a terminal window it works AND I am NOT prompted to press an "OK" button
// If I run it via a cron job I get:
//Set DISPLAY environment variable, use -display option
//   or check permissions of your X-Server
//   (See "man X" resp. "man xhost" for details)
$command = "bash /home/db/support/support_application/dud1.sh";

print ">>>command>$command<<br>\n";

$result = exec($command, $output, $error_code);

if ($error_code > 0)
{
  print "Unable to execute command - code was >$error_code<";
}
else
{
  print "No error reported<br>\n";
}

print "Finished<br>\n";
?>




  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/sussex/attachments/20070813/bbcd53b2/attachment.htm 


More information about the Sussex mailing list