From owner-freebsd-questions@freebsd.org Sat Jan 9 13:35:02 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6688AA69654 for ; Sat, 9 Jan 2016 13:35:02 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BA561770 for ; Sat, 9 Jan 2016 13:35:01 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-101-208.dynamic.qsc.de [92.195.101.208]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 5F9843CE3E; Sat, 9 Jan 2016 14:34:57 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id u09DYvYM002070; Sat, 9 Jan 2016 14:34:57 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Sat, 9 Jan 2016 14:34:56 +0100 From: Polytropon To: Bernt Hansson Cc: "freebsd-questions@freebsd.org" Subject: Re: Printer question Message-Id: <20160109143456.74f48f42.freebsd@edvax.de> In-Reply-To: <5690FCED.7000401@bananmonarki.se> References: <5690FCED.7000401@bananmonarki.se> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 13:35:02 -0000 On Sat, 9 Jan 2016 13:28:29 +0100, Bernt Hansson wrote: > I have a question about laserjet printers that support HPGL. > > How do one switch from ps/pcl/pjl to hpgl the code for doing so under > dos is Ec%#B where # is 0 or 1. > > But how to do that with a print filter? Understand the printer filter basically as a program that reads from standard input, does some magic, and writes to standard output. The input "language" usually is PS, and the output will be redirected to where the printer will accept actual input - a network address, a parallel port, a file, whatever. But as part of the magic, the program can write _anything_ it desires to standard output. Let the print filter look like this: #!/bin/sh /usr/bin/printf "Ec%1B" || exit 2 /usr/local/bin/your_hpgl_filter -outfile - && exit 0 exit 2 Depending on your experience of printer behaviour, it _might_ be needed to code printf "Ec%1B\r\n" to add a DOS-like line break (CR _and_ LF) if the printer should require it. Test this if needed. Of course you can switch back by coding printf "Ec%0B" at a later step, for example if you want to combine HP-GL with PCL or PS (if the printer should support that). -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...