Re: Printing via webapp

Re: Printing via webapp

am 29.05.2007 22:55:48 von Stut

Moore, Joshua wrote:
> Im having a few odd issues with printing and im hoping someone can help me.
>
> I can manually print to my barcode printer just fine (FILE > browser). However if I try and print using PHP printer_write it doesn't
> print. Yes I have the php_printer.dll installed. My code:
>
> > function getPrinter($SharedPrinterName) {
>
> global $REMOTE_ADDR;
>
> $host = getHostByAddr($REMOTE_ADDR);
>
> return "\\\\".$host."\\".$SharedPrinterName;
>
> }
>
> $handle = printer_open(getPrinter("ZebraZ4M"));
>
> printer_write($handle, "Text to print");
>
> printer_close($handle);
>
> ?>
>
> Gives the following error:
>
> Warning: printer_write() [function.printer-write
> ]: couldn't allocate the
> printerjob [1804] in W:\www\test\print.php on line 19
>
> And it doesn't print. I'm quite lost. Also, im using uniform server on
> windows XP and I do have my printer drivers install since I can print
> manually just fine...

It's almost certainly permissions-related. The user that your web server
runs as needs to have access to the printer.

-Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Printing via webapp

am 29.05.2007 22:57:17 von Joshua.Moore

------_=_NextPart_001_01C7A233.F12247F4
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Im having a few odd issues with printing and im hoping someone can help =
me.

=20

I can manually print to my barcode printer just fine (FILE web
browser). However if I try and print using PHP printer_write it doesn't
print. Yes I have the php_printer.dll installed. My code:

=20


function getPrinter($SharedPrinterName) {

=20

global $REMOTE_ADDR;

=20

$host =3D getHostByAddr($REMOTE_ADDR);

=20

return "\\\\".$host."\\".$SharedPrinterName;

=20

}

$handle =3D printer_open(getPrinter("ZebraZ4M"));

=20

printer_write($handle, "Text to print");

=20

printer_close($handle);

=20

?>

=20

Gives the following error:

=20


Warning: printer_write() [function.printer-write
]: couldn't allocate the
printerjob [1804] in W:\www\test\print.php on line 19

=20

And it doesn't print. I'm quite lost. Also, im using uniform server on
windows XP and I do have my printer drivers install since I can print
manually just fine...

=20

Any ideas? Thanks


------_=_NextPart_001_01C7A233.F12247F4--

Re: Printing via webapp

am 29.05.2007 23:05:11 von Stut

Moore, Joshua wrote:
> But under printer permissions its set to allow "everyone" to print.

I don't know enough about Windows security to be much more help here,
but I will say that if you're using IIS then the IUSR_machine user is
'special' and lacks a lot of the permissions that normal users have.

Probably worth checking the result of printer_open - I'm guessing it's
failing. You may also want to search the archives of this list as
problems with printing come up fairly frequently.

-Stut

> -----Original Message-----
> From: Stut [mailto:stuttle@gmail.com]
> Sent: Tuesday, May 29, 2007 1:56 PM
> To: Moore, Joshua
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Printing via webapp
>
> Moore, Joshua wrote:
>> Im having a few odd issues with printing and im hoping someone can help me.
>>
>> I can manually print to my barcode printer just fine (FILE >> browser). However if I try and print using PHP printer_write it doesn't
>> print. Yes I have the php_printer.dll installed. My code:
>>
>> >> function getPrinter($SharedPrinterName) {
>>
>> global $REMOTE_ADDR;
>>
>> $host = getHostByAddr($REMOTE_ADDR);
>>
>> return "\\\\".$host."\\".$SharedPrinterName;
>>
>> }
>>
>> $handle = printer_open(getPrinter("ZebraZ4M"));
>>
>> printer_write($handle, "Text to print");
>>
>> printer_close($handle);
>>
>> ?>
>>
>> Gives the following error:
>>
>> Warning: printer_write() [function.printer-write
>> ]: couldn't allocate the
>> printerjob [1804] in W:\www\test\print.php on line 19
>>
>> And it doesn't print. I'm quite lost. Also, im using uniform server on
>> windows XP and I do have my printer drivers install since I can print
>> manually just fine...
>
> It's almost certainly permissions-related. The user that your web server
> runs as needs to have access to the printer.
>
> -Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Printing via webapp

am 29.05.2007 23:06:30 von Joshua.Moore

But under printer permissions its set to allow "everyone" to print.

-----Original Message-----
From: Stut [mailto:stuttle@gmail.com]=20
Sent: Tuesday, May 29, 2007 1:56 PM
To: Moore, Joshua
Cc: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp

Moore, Joshua wrote:
> Im having a few odd issues with printing and im hoping someone can =
help me.
>=20
> I can manually print to my barcode printer just fine (FILE web
> browser). However if I try and print using PHP printer_write it =
doesn't
> print. Yes I have the php_printer.dll installed. My code:
>=20
> > function getPrinter($SharedPrinterName) {
>=20
> global $REMOTE_ADDR;
>=20
> $host =3D getHostByAddr($REMOTE_ADDR);
>=20
> return "\\\\".$host."\\".$SharedPrinterName;
>=20
> }
>=20
> $handle =3D printer_open(getPrinter("ZebraZ4M"));
>=20
> printer_write($handle, "Text to print");
>=20
> printer_close($handle);
>=20
> ?>
>=20
> Gives the following error:
>=20
> Warning: printer_write() [function.printer-write
> ]: couldn't allocate =
the
> printerjob [1804] in W:\www\test\print.php on line 19
>=20
> And it doesn't print. I'm quite lost. Also, im using uniform server on
> windows XP and I do have my printer drivers install since I can print
> manually just fine...

It's almost certainly permissions-related. The user that your web server =

runs as needs to have access to the printer.

-Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Printing via webapp

am 29.05.2007 23:12:05 von Stut

Moore, Joshua wrote:
> No, im not using IIS =\ since im using Uniform Server I thought it would just
> use the same user that im logged in with running the service...

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

Check the task manager and see what user it's running as. Whatever the
outcome I would say it's worth asking on a mailing list for that
particular server as well as here.

-Stut

> -----Original Message-----
> From: Stut [mailto:stuttle@gmail.com]
> Sent: Tuesday, May 29, 2007 2:05 PM
> To: Moore, Joshua
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Printing via webapp
>
> Moore, Joshua wrote:
>> But under printer permissions its set to allow "everyone" to print.
>
> I don't know enough about Windows security to be much more help here,
> but I will say that if you're using IIS then the IUSR_machine user is
> 'special' and lacks a lot of the permissions that normal users have.
>
> Probably worth checking the result of printer_open - I'm guessing it's
> failing. You may also want to search the archives of this list as
> problems with printing come up fairly frequently.
>
> -Stut
>
>> -----Original Message-----
>> From: Stut [mailto:stuttle@gmail.com]
>> Sent: Tuesday, May 29, 2007 1:56 PM
>> To: Moore, Joshua
>> Cc: php-windows@lists.php.net
>> Subject: Re: [PHP-WIN] Printing via webapp
>>
>> Moore, Joshua wrote:
>>> Im having a few odd issues with printing and im hoping someone can help
> me.
>>> I can manually print to my barcode printer just fine (FILE >>> browser). However if I try and print using PHP printer_write it doesn't
>>> print. Yes I have the php_printer.dll installed. My code:
>>>
>>> >>> function getPrinter($SharedPrinterName) {
>>>
>>> global $REMOTE_ADDR;
>>>
>>> $host = getHostByAddr($REMOTE_ADDR);
>>>
>>> return "\\\\".$host."\\".$SharedPrinterName;
>>>
>>> }
>>>
>>> $handle = printer_open(getPrinter("ZebraZ4M"));
>>>
>>> printer_write($handle, "Text to print");
>>>
>>> printer_close($handle);
>>>
>>> ?>
>>>
>>> Gives the following error:
>>>
>>> Warning: printer_write() [function.printer-write
>>> ]: couldn't allocate the
>>> printerjob [1804] in W:\www\test\print.php on line 19
>>>
>>> And it doesn't print. I'm quite lost. Also, im using uniform server on
>>> windows XP and I do have my printer drivers install since I can print
>>> manually just fine...
>> It's almost certainly permissions-related. The user that your web server
>> runs as needs to have access to the printer.
>>
>> -Stut
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Printing via webapp

am 29.05.2007 23:14:39 von Joshua.Moore

No, im not using IIS =3D\ since im using Uniform Server I thought it =
would just
use the same user that im logged in with running the service...

-----Original Message-----
From: Stut [mailto:stuttle@gmail.com]=20
Sent: Tuesday, May 29, 2007 2:05 PM
To: Moore, Joshua
Cc: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp

Moore, Joshua wrote:
> But under printer permissions its set to allow "everyone" to print.

I don't know enough about Windows security to be much more help here,=20
but I will say that if you're using IIS then the IUSR_machine user is=20
'special' and lacks a lot of the permissions that normal users have.

Probably worth checking the result of printer_open - I'm guessing it's=20
failing. You may also want to search the archives of this list as=20
problems with printing come up fairly frequently.

-Stut

> -----Original Message-----
> From: Stut [mailto:stuttle@gmail.com]=20
> Sent: Tuesday, May 29, 2007 1:56 PM
> To: Moore, Joshua
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Printing via webapp
>=20
> Moore, Joshua wrote:
>> Im having a few odd issues with printing and im hoping someone can =
help
me.
>>
>> I can manually print to my barcode printer just fine (FILE web
>> browser). However if I try and print using PHP printer_write it =
doesn't
>> print. Yes I have the php_printer.dll installed. My code:
>>
>> >> function getPrinter($SharedPrinterName) {
>>
>> global $REMOTE_ADDR;
>>
>> $host =3D getHostByAddr($REMOTE_ADDR);
>>
>> return "\\\\".$host."\\".$SharedPrinterName;
>>
>> }
>>
>> $handle =3D printer_open(getPrinter("ZebraZ4M"));
>>
>> printer_write($handle, "Text to print");
>>
>> printer_close($handle);
>>
>> ?>
>>
>> Gives the following error:
>>
>> Warning: printer_write() [function.printer-write
>> ]: couldn't allocate =
the
>> printerjob [1804] in W:\www\test\print.php on line 19
>>
>> And it doesn't print. I'm quite lost. Also, im using uniform server =
on
>> windows XP and I do have my printer drivers install since I can print
>> manually just fine...
>=20
> It's almost certainly permissions-related. The user that your web =
server=20
> runs as needs to have access to the printer.
>=20
> -Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Printing via webapp

am 30.05.2007 03:49:47 von Niel Archer

> 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

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Printing via webapp

am 30.05.2007 14:44:29 von Juan Ignacio Borda

--------------000102020405020304040309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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
>
>

--------------000102020405020304040309--

RE: Printing via webapp

am 30.05.2007 15:24:20 von Joshua.Moore

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 =3D getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle =3D 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 :(=20

Im stuck, any ideas?

-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster@baexporta.gba.gov.ar]=20
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows@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=20
print or acces a shared resource.
> =20
>> In that case I really can't help you since I've never heard of =
Uniform=20
>> Server.
>> =20
>
> 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
>
> =20

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Printing via webapp

am 30.05.2007 15:41:38 von Joshua.Moore

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@tusd1.org]=20
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows@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 =3D getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle =3D 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 :(=20

Im stuck, any ideas?

-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster@baexporta.gba.gov.ar]=20
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows@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=20
print or acces a shared resource.
> =20
>> In that case I really can't help you since I've never heard of =
Uniform=20
>> Server.
>> =20
>
> 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
>
> =20

--=20
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Printing via webapp

am 30.05.2007 16:56:12 von Joshua.Moore

------_=_NextPart_001_01C7A2CA.AA73C6DA
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

I'll give that a try. But when you goto FILE that
isn't a RAW print mode?

=20

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

=20

________________________________

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

=20

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,
=20
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...
=20
:(
=20
-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore@tusd1.org]=20
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows@lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp
=20
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.
=20
However looked on the PHP manual comments it said this:
=20
"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "
=20
so my code:
=20
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host =3D getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle =3D printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>
=20
The warning goes away but it doesn't print!! :( Nothing in the apache2 =
error
logs :(=20
=20
Im stuck, any ideas?
=20
-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster@baexporta.gba.gov.ar]=20
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp
=20
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=20
print or acces a shared resource.
=20

=20
=20

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

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?
=20
http://www.uniformserver.com/
=20
=20
=20
Niel
=20
=20
=20

=20
=20

------_=_NextPart_001_01C7A2CA.AA73C6DA--

RE: Printing via webapp

am 31.05.2007 18:33:31 von Joshua.Moore

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 =3D getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}

$printtest =3D "^XA";
$printtest =3D "^FO50,50^ADN,36,20^FDjoshmoore";
$printtest =3D "^FS";
$printtest =3D "^XZ";
$handle =3D 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@tusd1.org]=20
Sent: Wednesday, May 30, 2007 7:56 AM
To: Juan Ignacio Borda
Cc: php-windows@lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

I'll give that a try. But when you goto FILE that
isn't a RAW print mode?

=20

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

=20

________________________________

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

=20

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,
=20
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...
=20
:(
=20
-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore@tusd1.org]=20
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows@lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp
=20
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.
=20
However looked on the PHP manual comments it said this:
=20
"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "
=20
so my code:
=20
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host =3D getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle =3D printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>
=20
The warning goes away but it doesn't print!! :( Nothing in the apache2 =
error
logs :(=20
=20
Im stuck, any ideas?
=20
-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster@baexporta.gba.gov.ar]=20
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp
=20
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=20
print or acces a shared resource.
=20

=20
=20

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

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?
=20
http://www.uniformserver.com/
=20
=20
=20
Niel
=20
=20
=20

=20
=20

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Printing via webapp

am 31.05.2007 19:35:22 von Joshua.Moore

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=20
Sent: Thursday, May 31, 2007 9:34 AM
To: Moore, Joshua; Juan Ignacio Borda
Cc: php-windows@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 =3D getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}

$printtest =3D "^XA";
$printtest =3D "^FO50,50^ADN,36,20^FDjoshmoore";
$printtest =3D "^FS";
$printtest =3D "^XZ";
$handle =3D 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@tusd1.org]=20
Sent: Wednesday, May 30, 2007 7:56 AM
To: Juan Ignacio Borda
Cc: php-windows@lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

I'll give that a try. But when you goto FILE that
isn't a RAW print mode?

=20

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

=20

________________________________

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

=20

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,
=20
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...
=20
:(
=20
-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore@tusd1.org]=20
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows@lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp
=20
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.
=20
However looked on the PHP manual comments it said this:
=20
"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "
=20
so my code:
=20
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host =3D getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle =3D printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>
=20
The warning goes away but it doesn't print!! :( Nothing in the apache2 =
error
logs :(=20
=20
Im stuck, any ideas?
=20
-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster@baexporta.gba.gov.ar]=20
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp
=20
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=20
print or acces a shared resource.
=20

=20
=20

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

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?
=20
http://www.uniformserver.com/
=20
=20
=20
Niel
=20
=20
=20

=20
=20

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Printing via webapp

am 31.05.2007 19:50:40 von Niel Archer

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

Easily


Niel

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php