From: "Moore, Joshua" on
I'll give that a try. But when you goto FILE<Print from a web browser, that
isn't a RAW print mode?



My user account owns the print job when it enters the list.



________________________________

From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 7:08 AM
To: Moore, Joshua
Subject: Re: [PHP-WIN] Printing via webapp



may be you have to send special codes to printer some printers lacks the
ability to print direct from raw (ie Epson LX 300 has a lot of special codes,
escape codes, that can be sent before start printing) did you check the
manual to see if it's the case?

----------------------------------

One more thing,

When I run my php script I see that the printjob gets put into the windows
printing list for that printer however it pops up, says its spolling under
the status then disappears and nothing prints...

:(

-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore(a)tusd1.org]
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows(a)lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

Yes it is a printer on LPT1. Well IF it is indeed a permissions problem then
I would guess its permissions on the barcode printer im trying to print too
because if I change the printer to my LaserJet it prints fine with no
warnings or errors.

However looked on the PHP manual comments it said this:

"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "

so my code:

<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>

The warning goes away but it doesn't print!! :( Nothing in the apache2 error
logs :(

Im stuck, any ideas?

-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows(a)lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp

I'm intrested on this function too, did you tried to print locally let's
say to LPT1 ? this will jelp you debug if it's the case that you can't
print or acces a shared resource.





In that case I really can't help you since I've never heard
of Uniform
Server.



Uniform Server is a WAMP package. It was mentioned on this or the Db
list recently. Presumably then, Apache's permissions would be the
determining factor?

http://www.uniformserver.com/



Niel






From: "Moore, Joshua" on
Well I just found out most of the Zebra barcode printers have their own code
(ZPL code). So I try and send that data to the printer but still no luck.
Heres my code:

<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}

$printtest = "^XA";
$printtest = "^FO50,50^ADN,36,20^FDjoshmoore";
$printtest = "^FS";
$printtest = "^XZ";
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, $printtest);
printer_close($handle);
?>

This would be the printer code to print a name:

^XA
^FO50,50^ADN,36,20^FDjoshmoore
^FS
^XZ

Is my php correct? I still seem to have the same problem. It will send to the
printjob list but nothing prints from the printer. Might be still
permissions? Maybe printer settings?

Thanks

-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore(a)tusd1.org]
Sent: Wednesday, May 30, 2007 7:56 AM
To: Juan Ignacio Borda
Cc: php-windows(a)lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

I'll give that a try. But when you goto FILE<Print from a web browser, that
isn't a RAW print mode?



My user account owns the print job when it enters the list.



________________________________

From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 7:08 AM
To: Moore, Joshua
Subject: Re: [PHP-WIN] Printing via webapp



may be you have to send special codes to printer some printers lacks the
ability to print direct from raw (ie Epson LX 300 has a lot of special codes,
escape codes, that can be sent before start printing) did you check the
manual to see if it's the case?

----------------------------------

One more thing,

When I run my php script I see that the printjob gets put into the windows
printing list for that printer however it pops up, says its spolling under
the status then disappears and nothing prints...

:(

-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore(a)tusd1.org]
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows(a)lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

Yes it is a printer on LPT1. Well IF it is indeed a permissions problem then
I would guess its permissions on the barcode printer im trying to print too
because if I change the printer to my LaserJet it prints fine with no
warnings or errors.

However looked on the PHP manual comments it said this:

"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "

so my code:

<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>

The warning goes away but it doesn't print!! :( Nothing in the apache2 error
logs :(

Im stuck, any ideas?

-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows(a)lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp

I'm intrested on this function too, did you tried to print locally let's
say to LPT1 ? this will jelp you debug if it's the case that you can't
print or acces a shared resource.





In that case I really can't help you since I've never heard
of Uniform
Server.



Uniform Server is a WAMP package. It was mentioned on this or the Db
list recently. Presumably then, Apache's permissions would be the
determining factor?

http://www.uniformserver.com/



Niel






From: "Moore, Joshua" on
Well ive got some new information and I need some suggestions.

I can print to the printer via this ZPL code. The ZPL code is just in a
textfile with the extension .zpl. To print successfully to the barcode
printer all I have to do is copy the zpl file to the printer using a
commandline:

Copy test.zpl LPT1

So I was thinking I could use a batch script and call it with exec() however
the zpl file would have to be generated via PHP when the user clicks submit
on the form. I am using a mysql DB which stores the data for the barcodes and
then have the PHP pull the information from the DB that the user typed in
then create the zpl file with that info.

That's what ive come up with. Does anyone have any better solutions? Now I
don't expect people to be printing labels at the same time so im not too
worried about that. But still doesn't seem quite like the best way to
accomplish this task.

Thanks for your help guys!

Oh and one more question. Can php create a text file with the exenstion of
..zpl instead of txt?

-----Original Message-----
From: Moore, Joshua
Sent: Thursday, May 31, 2007 9:34 AM
To: Moore, Joshua; Juan Ignacio Borda
Cc: php-windows(a)lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

Well I just found out most of the Zebra barcode printers have their own code
(ZPL code). So I try and send that data to the printer but still no luck.
Heres my code:

<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}

$printtest = "^XA";
$printtest = "^FO50,50^ADN,36,20^FDjoshmoore";
$printtest = "^FS";
$printtest = "^XZ";
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, $printtest);
printer_close($handle);
?>

This would be the printer code to print a name:

^XA
^FO50,50^ADN,36,20^FDjoshmoore
^FS
^XZ

Is my php correct? I still seem to have the same problem. It will send to the
printjob list but nothing prints from the printer. Might be still
permissions? Maybe printer settings?

Thanks

-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore(a)tusd1.org]
Sent: Wednesday, May 30, 2007 7:56 AM
To: Juan Ignacio Borda
Cc: php-windows(a)lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

I'll give that a try. But when you goto FILE<Print from a web browser, that
isn't a RAW print mode?



My user account owns the print job when it enters the list.



________________________________

From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 7:08 AM
To: Moore, Joshua
Subject: Re: [PHP-WIN] Printing via webapp



may be you have to send special codes to printer some printers lacks the
ability to print direct from raw (ie Epson LX 300 has a lot of special codes,
escape codes, that can be sent before start printing) did you check the
manual to see if it's the case?

----------------------------------

One more thing,

When I run my php script I see that the printjob gets put into the windows
printing list for that printer however it pops up, says its spolling under
the status then disappears and nothing prints...

:(

-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore(a)tusd1.org]
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows(a)lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

Yes it is a printer on LPT1. Well IF it is indeed a permissions problem then
I would guess its permissions on the barcode printer im trying to print too
because if I change the printer to my LaserJet it prints fine with no
warnings or errors.

However looked on the PHP manual comments it said this:

"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "

so my code:

<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>

The warning goes away but it doesn't print!! :( Nothing in the apache2 error
logs :(

Im stuck, any ideas?

-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows(a)lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp

I'm intrested on this function too, did you tried to print locally let's
say to LPT1 ? this will jelp you debug if it's the case that you can't
print or acces a shared resource.





In that case I really can't help you since I've never heard
of Uniform
Server.



Uniform Server is a WAMP package. It was mentioned on this or the Db
list recently. Presumably then, Apache's permissions would be the
determining factor?

http://www.uniformserver.com/



Niel






From: Niel Archer on
> Oh and one more question. Can php create a text file with the exenstion of
> zpl instead of txt?

Easily


Niel