Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > 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. 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/