From owner-freebsd-questions@freebsd.org Tue May 5 16:55:15 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FB1213CB98 for ; Tue, 5 May 2020 16:55:15 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Gm761hkmz4F8n for ; Tue, 5 May 2020 16:55:13 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.9.16]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPA (Nemesis) id 1N64JK-1j3M2h208O-016T86; Tue, 05 May 2020 18:55:11 +0200 Date: Tue, 5 May 2020 18:55:10 +0200 From: Polytropon To: Victor Sudakov Cc: freebsd-questions@freebsd.org, Polytropon Subject: Re: Brother HL-L2340D printer and lpd? Message-Id: <20200505185510.00b622e3.freebsd@edvax.de> In-Reply-To: <20200505161952.GA34844@admin.sibptus.ru> References: <20200503171259.GA48627@admin.sibptus.ru> <20200505161952.GA34844@admin.sibptus.ru> 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-Provags-ID: V03:K1:8OvrCXEny0L4SO+k2/Kd+fAs/IqwHhvb1lmXFdrmnbsK4rauYo1 RvpQ4/Nfqia8bfNfeLHwYb4Ev49sti+PQr2oY7v74Pisg3hNBJrBEV6XoxDCoPVetJQ1KM0 SAc6lcy1SPx+NBcOiJythOkmuoltBa6lqDrQrag4GbE0+6+lRYLIaFRw52UjXGRwEpm5aBY H7GF/j8IqmnsUzD0d/ogg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:yI7N3qIcfLo=:pV+DKTcurVjM5XoPpQL2ak Jkdx+HYE2xYtrnOUeR+1wB5dX0tYg/baQUxi89YU1PDcdNJzqXTFEEPCiZLAiauHMjxZnmWcO gWQgYtJ3sKeRrz54C7Mff+8XG+yiiQGPzdla13vKQmr87vmK0L64qd59pQvQ3Po294iwiki+r Sfr7OwlhKPLcwr6hi8GhS3oYduvStHTiCj7OoSYXdS9HZi0cl/BkalhG4o2vZeIp07m70NKEH QfdkcW2COys9udjmyimuLdtGCsMLpnve9znxRutJOqAgbXTX9YRNlQ1Aq4UugJhNbSA879md1 /cwqLHLuC6LBQj4ahF5/M5zapIHxY36EL/5anbnIlxSlcQZfFShJMGTlNzpHaBG2hBNIq8baK Djnm9sk+qQxE7GQYW65xy0umPJv8YfTd2qk6kT0Qo3OXWNUMHDJ6OFVZ0bJkKGFvvw4HHbOCh OUnRERI9wvKI/h02h57jiUdBVabS2TScsY8TtNVuZQ31e1YYjS1YhkPdz0BzoEn9WGTiYMqIF GvnyQk17jVkRs/J2y/6NE23TvH7SSTRY6OO8TaIa6spl2//ygqGcPXWbZSCdKWAG3/o4WFvRC 8FfdOJB9sWhFHlJc+mXGigiai723zNiZtNdWgisdlUW/NolZArXPHitHwjedCIvTZUrdoHc+r l4YQve19lcowEbhYG+/78xRYWbQZTfHe9DC7R0aOGdfNB/xHMlTjKa5w9pOjn7nTPqv43BWEi uUpVuNG8p/mrayQVEY6Z1UCx+tkimQgLLF3tI4DikzviFCsuZdSBnUH+wS2WTJGD/aLQs1S7p Qin/r6bLZB18KOeJI4QKHcAM2R7gRlASrnBxbbj3w6wPGCt/r5z5Jg13pkCNzCdkCYUNLp9 X-Rspamd-Queue-Id: 49Gm761hkmz4F8n X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 217.72.192.75) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [5.67 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[16.9.222.94.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; SH_EMAIL_ZRD(0.00)[192.168.1.74]; ARC_NA(0.00)[]; ASN(0.00)[asn:8560, ipnet:217.72.192.0/20, country:DE]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; SH_EMAIL_DBL_DONT_QUERY_IPS(0.00)[192.168.1.74]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.93)[0.934,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[0.999,0]; RCVD_IN_DNSWL_NONE(0.00)[75.192.72.217.list.dnswl.org : 127.0.5.0]; MID_CONTAINS_FROM(1.00)[]; R_SPF_NA(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[75.192.72.217.rep.mailspike.net : 127.0.0.17]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(0.34)[ip: (-0.61), ipnet: 217.72.192.0/20(0.29), asn: 8560(2.04), country: DE(-0.02)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2020 16:55:15 -0000 On Tue, 5 May 2020 23:19:52 +0700, Victor Sudakov wrote: > Victor Sudakov wrote: > > > > I'm trying to use a Brother HL-L2340D printer as a simple networked > > line printer with lpd. I've successfully used HP and Canon printers like > > that with a simple printcap like this: > > The story continues with some good news. > > Thanks to much insight and help from Polytropon (off list also), and > this page: > https://support.brother.com/g/b/faqend.aspx?c=us&lang=en&prod=hll2340dw_us_eu_as&faqid=faq00100602_000 > > I've been able to print PDF files (lpr -P ps mozilla.pdf) > on this printer with the following printcap entry: > > ps|Brother HL-L2340D series PostScript:\ > :sh:\ > :lp=9100@192.168.1.74:\ > :if=/usr/local/etc/ps2pcl.sh:\ > :sd=/var/spool/output/lpd2:lf=/var/log/lpd-errs: > > while the ps2pcl.sh looks like this (thanks again to Polytropon): > > #!/bin/sh > > #/usr/bin/printf "\033&k2G" || exit 2 > /usr/local/bin/gs -q -dBATCH -dNOPAUSE -dPARANOIDSAFER -dSAFER \ > -sDEVICE=hl1250 -sPAPERSIZE=a4 -r600x600 \ > -sOutputFile=- - && exit 0 > exit 2 > > So GhostScript's "hl1250" driver works wonders, I even see Cyrillic > text in the printed PDF. Basically, gs will "raster" any PS input it gets. So whatever symbols are there, they will work without any further tools, be it chinese symbols or images or german Umlauts. :-) Thanks for posting the _solution_ to your problem. Future readers will now know that gs's filter "hl1250" works with this particular printer. > Now two questions are left: > > 1. How the heck do I print text files with this setup? Should I convert > them to PostScript first, and how? UTF-8 Cyrillic support is crucial. Yes, gs expects PS as its input. For programs that print (except here: Firefox), PS is the default output anyway. But if you have ASCII text, you need to turn it into PS. The easiest way to do this is the port "a2ps" (ASCII to PostScript). It has several options that you can tweak if the default output is not sufficiently formatted, like headers or margins. Personally, I use "encript" for turning ASCII reports into formatted pages. Here is an example: enscript -o ta_t4_${ACCT}.ps \ --media=A4 \ --margins=50:10:10:10 \ --font=Courier11 \ --header="Transactions for ${ACCT}"'||Page $% of $=' \ ta_t4_${ACCT}.txt Last entry is the input file, -o specifies the output file. You can use - for both or use | to "pass data". This kind of PS can then be easily printed. > 2. How do I convince Mozilla Firefox that I now have a PostScript > printer and it can print directly to it, not just to a PDF file? It does > not seem to care for /etc/printcap. Correct. Firefox doesn't care what you want. ;-) The default "print to file" of Firefox now uses PDF, as many modern printers accept PDF directly. But you can use the tool "pdftops" installed by the port "xpdf". Sidenote: You can even put this into an additional printer filter in /etc/printcap, for example with the printer name "pdf", and address that printer from Firefox's print dialog, to do this preprocessing. And the printer will keep working even if both Brother and "Windows" have stopped offering a driver for it... ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...