Hi All
Would anyone have any suggestions of how best to approach sending ZPL commands to a compatible printer?
If the printer is on the network I can get this to work using ChilKat such as https://www.example-code.com/foxpro/socket_connect.asp
But I have also found that you can get ZPL to a printer that is connected via USB or network using the Generic / Text Only Driver ... this works with a simple example from
https://labelary.com/viewer.html
but if the commands become more extensive (maybe because an image has been included) then this method goes wrong I think because the driver is doing something relating to page size? But not sure.
If possible I would like a native VFP method of connecting to either a USB or Network connected ZPL printer and be able to send whatever I like ... thoughts?
TIA
Chris Davis
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Hi Chris,
You connect to the printer with a regular cPrinterName = GETPRINTER() SET PRINTER TO NAME (cPrinterName)
Then you open the printer SET PRINTER ON
And all commandlines starting with ??? get sent directly, without conversion of the Windows drivers. thus:
#DEFINE CR CHR(13)+CHR(10)
??? "^XA" + CR ??? "^CF0,60" + CR ??? "^FO50,50^GB100,100,100^FS" + CR
SET PRINTER OFF SET PRINTER TO
One caveat: The ??? command also translates embedded strings between curly braces:
??? "This is a printer control string: {27}Q{100} to set the right margin"
If you need to print that left curly bracket in real, then you need to do a "{{}"
wOOdy
-----Original Message----- From: ProFox profox-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 12:27 PM To: ProFox Email List profox@leafe.com Subject: ZPL
Hi All
Would anyone have any suggestions of how best to approach sending ZPL commands to a compatible printer?
If the printer is on the network I can get this to work using ChilKat such as https://www.example-code.com/foxpro/socket_connect.asp
But I have also found that you can get ZPL to a printer that is connected via USB or network using the Generic / Text Only Driver ... this works with a simple example from
https://labelary.com/viewer.html
but if the commands become more extensive (maybe because an image has been included) then this method goes wrong I think because the driver is doing something relating to page size? But not sure.
If possible I would like a native VFP method of connecting to either a USB or Network connected ZPL printer and be able to send whatever I like ... thoughts?
TIA
Chris Davis
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Thanks Woody
That seems to behave the same as me using ...
STRTOFILE(label1.mlabel,"c:\batch\testlabel.txt") TYPE c:\batch\testlabel.txt TO PRINTER
If I do this with the example label from labelary it works fine, if I use it with my own label where I have an embedded image it doesn't. The embedded image command is long as it contains the data in hex format.
If I paste my own label into labelary it works, if I send me label to the printer via TCPIP socket using Chilkat it works. It just doesn't work when sending it via set printer to
Make sense?
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of juergen@wondzinski.de Sent: Monday, November 13, 2023 11:59 AM To: profoxtech@leafe.com Subject: RE: ZPL
Hi Chris,
You connect to the printer with a regular cPrinterName = GETPRINTER() SET PRINTER TO NAME (cPrinterName)
Then you open the printer SET PRINTER ON
And all commandlines starting with ??? get sent directly, without conversion of the Windows drivers. thus:
#DEFINE CR CHR(13)+CHR(10)
??? "^XA" + CR ??? "^CF0,60" + CR ??? "^FO50,50^GB100,100,100^FS" + CR
SET PRINTER OFF SET PRINTER TO
One caveat: The ??? command also translates embedded strings between curly braces:
??? "This is a printer control string: {27}Q{100} to set the right margin"
If you need to print that left curly bracket in real, then you need to do a "{{}"
wOOdy
-----Original Message----- From: ProFox profox-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 12:27 PM To: ProFox Email List profox@leafe.com Subject: ZPL
Hi All
Would anyone have any suggestions of how best to approach sending ZPL commands to a compatible printer?
If the printer is on the network I can get this to work using ChilKat such as https://www.example-code.com/foxpro/socket_connect.asp
But I have also found that you can get ZPL to a printer that is connected via USB or network using the Generic / Text Only Driver ... this works with a simple example from
https://labelary.com/viewer.html
but if the commands become more extensive (maybe because an image has been included) then this method goes wrong I think because the driver is doing something relating to page size? But not sure.
If possible I would like a native VFP method of connecting to either a USB or Network connected ZPL printer and be able to send whatever I like ... thoughts?
TIA
Chris Davis
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Done a bit more testing and capture the print job it looks like it only sends upto 16535 kB to the printer before it's then captured as a job? Make any sense?
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 12:44 PM To: profoxtech@leafe.com Subject: RE: ZPL
Thanks Woody
That seems to behave the same as me using ...
STRTOFILE(label1.mlabel,"c:\batch\testlabel.txt") TYPE c:\batch\testlabel.txt TO PRINTER
If I do this with the example label from labelary it works fine, if I use it with my own label where I have an embedded image it doesn't. The embedded image command is long as it contains the data in hex format.
If I paste my own label into labelary it works, if I send me label to the printer via TCPIP socket using Chilkat it works. It just doesn't work when sending it via set printer to
Make sense?
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of juergen@wondzinski.de Sent: Monday, November 13, 2023 11:59 AM To: profoxtech@leafe.com Subject: RE: ZPL
Hi Chris,
You connect to the printer with a regular cPrinterName = GETPRINTER() SET PRINTER TO NAME (cPrinterName)
Then you open the printer SET PRINTER ON
And all commandlines starting with ??? get sent directly, without conversion of the Windows drivers. thus:
#DEFINE CR CHR(13)+CHR(10)
??? "^XA" + CR ??? "^CF0,60" + CR ??? "^FO50,50^GB100,100,100^FS" + CR
SET PRINTER OFF SET PRINTER TO
One caveat: The ??? command also translates embedded strings between curly braces:
??? "This is a printer control string: {27}Q{100} to set the right margin"
If you need to print that left curly bracket in real, then you need to do a "{{}"
wOOdy
-----Original Message----- From: ProFox profox-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 12:27 PM To: ProFox Email List profox@leafe.com Subject: ZPL
Hi All
Would anyone have any suggestions of how best to approach sending ZPL commands to a compatible printer?
If the printer is on the network I can get this to work using ChilKat such as https://www.example-code.com/foxpro/socket_connect.asp
But I have also found that you can get ZPL to a printer that is connected via USB or network using the Generic / Text Only Driver ... this works with a simple example from
https://labelary.com/viewer.html
but if the commands become more extensive (maybe because an image has been included) then this method goes wrong I think because the driver is doing something relating to page size? But not sure.
If possible I would like a native VFP method of connecting to either a USB or Network connected ZPL printer and be able to send whatever I like ... thoughts?
TIA
Chris Davis
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Hi Chris,
I suspect that you have a "misbehaving char" in your hex data, something like Ctrl-Z, which terminates the standard DOS copy process.
If you need to transfer binary data to your printer, you could use this routine here:
??? ChrTran(File2Str("yourPicture.jpg"), "{", "{{}")
wOOdy
-----Original Message----- From: ProFox profox-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 3:13 PM To: profox@leafe.com Subject: RE: ZPL
Done a bit more testing and capture the print job it looks like it only sends upto 16535 kB to the printer before it's then captured as a job? Make any sense?
Thanks Woody
The image is already converted to hex and the { symbol doesn't appear in it ... if I don't get any further today I will create an actual example to demonstrate it better. Although I am just considering going the Chilkat route and sending the data via the socket and making a networked label printer a minimum requirement for our customers.
Appreciate your input so far.
Regards
Chris.
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of juergen@wondzinski.de Sent: Tuesday, November 14, 2023 8:27 AM To: profoxtech@leafe.com Subject: RE: ZPL
Hi Chris,
I suspect that you have a "misbehaving char" in your hex data, something like Ctrl-Z, which terminates the standard DOS copy process.
If you need to transfer binary data to your printer, you could use this routine here:
??? ChrTran(File2Str("yourPicture.jpg"), "{", "{{}")
wOOdy
-----Original Message----- From: ProFox profox-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 3:13 PM To: profox@leafe.com Subject: RE: ZPL
Done a bit more testing and capture the print job it looks like it only sends upto 16535 kB to the printer before it's then captured as a job? Make any sense?
[excessive quoting removed by server]
After a lot of testing it turns out this was a bug at the other end, I have obtained a patch for it and now VFP sends the data fine.
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Chris Davis Sent: Tuesday, November 14, 2023 9:41 AM To: profoxtech@leafe.com Subject: RE: ZPL
Thanks Woody
The image is already converted to hex and the { symbol doesn't appear in it ... if I don't get any further today I will create an actual example to demonstrate it better. Although I am just considering going the Chilkat route and sending the data via the socket and making a networked label printer a minimum requirement for our customers.
Appreciate your input so far.
Regards
Chris.
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of juergen@wondzinski.de Sent: Tuesday, November 14, 2023 8:27 AM To: profoxtech@leafe.com Subject: RE: ZPL
Hi Chris,
I suspect that you have a "misbehaving char" in your hex data, something like Ctrl-Z, which terminates the standard DOS copy process.
If you need to transfer binary data to your printer, you could use this routine here:
??? ChrTran(File2Str("yourPicture.jpg"), "{", "{{}")
wOOdy
-----Original Message----- From: ProFox profox-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 3:13 PM To: profox@leafe.com Subject: RE: ZPL
Done a bit more testing and capture the print job it looks like it only sends upto 16535 kB to the printer before it's then captured as a job? Make any sense?
[excessive quoting removed by server]
Woohoo! I love it when the bug belongs to someone else! :)
Paul H. Tarver Tarver Program Consultants, Inc.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Chris Davis Sent: Wednesday, November 15, 2023 8:14 AM To: profoxtech@leafe.com Subject: RE: ZPL
After a lot of testing it turns out this was a bug at the other end, I have obtained a patch for it and now VFP sends the data fine.
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Chris Davis Sent: Tuesday, November 14, 2023 9:41 AM To: profoxtech@leafe.com Subject: RE: ZPL
Thanks Woody
The image is already converted to hex and the { symbol doesn't appear in it ... if I don't get any further today I will create an actual example to demonstrate it better. Although I am just considering going the Chilkat route and sending the data via the socket and making a networked label printer a minimum requirement for our customers.
Appreciate your input so far.
Regards
Chris.
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of juergen@wondzinski.de Sent: Tuesday, November 14, 2023 8:27 AM To: profoxtech@leafe.com Subject: RE: ZPL
Hi Chris,
I suspect that you have a "misbehaving char" in your hex data, something like Ctrl-Z, which terminates the standard DOS copy process.
If you need to transfer binary data to your printer, you could use this routine here:
??? ChrTran(File2Str("yourPicture.jpg"), "{", "{{}")
wOOdy
-----Original Message----- From: ProFox profox-bounces@leafe.com On Behalf Of Chris Davis Sent: Monday, November 13, 2023 3:13 PM To: profox@leafe.com Subject: RE: ZPL
Done a bit more testing and capture the print job it looks like it only sends upto 16535 kB to the printer before it's then captured as a job? Make any sense?
[excessive quoting removed by server]
I love it even more when a bug can be definitively identified!
--
rk
From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Paul H. Tarver Sent: Wednesday, November 15, 2023 12:51 PM To: profoxtech@leafe.com Subject: RE: ZPL
Woohoo! I love it when the bug belongs to someone else! :)
Paul H. Tarver Tarver Program Consultants, Inc.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Chris Davis Sent: Wednesday, November 15, 2023 8:14 AM To: mailto:profoxtech@leafe.com Subject: RE: ZPL
After a lot of testing it turns out this was a bug at the other end, I have obtained a patch for it and now VFP sends the data fine.
TYPE is NOT the same as copying a file to a printer or network destination. It ASSuMEs it is sending text, and has problems with word wrap, long files without returns, etc. It is a dBASE II command and ought to be avoided. See https://hackfox.github.io/section4/s4g173.html for details.
On Mon, Nov 13, 2023 at 7:44 AM Chris Davis chrisd@actongate.co.uk wrote:
Thanks Woody
That seems to behave the same as me using ...
STRTOFILE(label1.mlabel,"c:\batch\testlabel.txt") TYPE c:\batch\testlabel.txt TO PRINTER
If I do this with the example label from labelary it works fine, if I use it with my own label where I have an embedded image it doesn't. The embedded image command is long as it contains the data in hex format.
To be fair I am getting the same result when sending the ZPL from notepad to the printer, it just doesn't work, I think because it's a large ZPL the print driver is sorting it out onto pages ... I've tried the continuous feed no break but it makes no difference
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Ted Roche Sent: Monday, November 13, 2023 3:25 PM To: profoxtech@leafe.com Subject: Re: ZPL
TYPE is NOT the same as copying a file to a printer or network destination. It ASSuMEs it is sending text, and has problems with word wrap, long files without returns, etc. It is a dBASE II command and ought to be avoided. See https://hackfox.github.io/section4/s4g173.html for details.
On Mon, Nov 13, 2023 at 7:44 AM Chris Davis chrisd@actongate.co.uk wrote:
Thanks Woody
That seems to behave the same as me using ...
STRTOFILE(label1.mlabel,"c:\batch\testlabel.txt") TYPE c:\batch\testlabel.txt TO PRINTER
If I do this with the example label from labelary it works fine, if I use it with my own label where I have an embedded image it doesn't. The embedded image command is long as it contains the data in hex format.
_______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/CACW6n4vishu4ZDykvNzjRY2cvL0-TgB_HRCN9Kmt_K... ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.