delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Message-ID: | <42C48D36.5090002@igc.org> |
Date: | Thu, 30 Jun 2005 17:24:22 -0700 |
From: | David Vergin <dvergin AT igc DOT org> |
User-Agent: | Mozilla Thunderbird 1.0.2 (Windows/20050317) |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Trouble Sending Printer Codes from Perl to Printer |
References: | <42C48248 DOT 4090404 AT igc DOT org> <da1vu7$ded$1 AT sea DOT gmane DOT org> |
In-Reply-To: | <da1vu7$ded$1@sea.gmane.org> |
> David Vergin wrote: >> system(qq/echo -en "$data_str" | lpr -oraw/); >> That does not work in cygwin. Lasse wrote: > Why would want use echo for this? Just use a piped open directly to lpr: > > open(FH, '| lpr -oraw'); > print(FH, $data_str); > close(FH); Thank you Lasse. <sheepish grin> This is seriously embarrassing! I was so focussed on fixing the received solution, I failed to step back and look at the problem afresh. For the sake of others who may see this exchange and want a fuller example, here's a quick working demo. Note the necessity of sending both \r and \n since we are bypassing the normal expansion that would do that for us. And proper error checks still need to be added. Don't try this with these codes unless you have an old Epson inkjet printer or you will likely give your printer indigestion. open(FH, '| lpr'); print(FH "\033X\026\030\000"); #condensed spacing print(FH "modified\r\nstuff\r\n"); print(FH "\033\@"); #reset printer print(FH "Normal\r\nprint\r\n"); print(FH "\f"); #formfeed close(FH); Regards, David -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |