Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Salvador Mirzo Newsgroups: comp.misc Subject: Re: terminal only for two weeks Date: Wed, 12 Feb 2025 13:12:42 -0300 Organization: A noiseless patient Spider Lines: 79 Message-ID: <87frkjuop1.fsf@example.com> References: <67447ce1$0$22$882e4bbb@reader.netnews.com> <87bjwb4jat.fsf@example.com> <87plkq34b8.fsf@example.com> <87o7071s35.fsf@example.com> <5Lra_5CB4XHr0riW@violet.siamics.net> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 12 Feb 2025 17:12:42 +0100 (CET) Injection-Info: dont-email.me; posting-host="41b1bae619a6290ef4050ee353af0785"; logging-data="2523764"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ilfsy3zkzjdAZDSJjkGFy2xLeKa6Db6M=" Cancel-Lock: sha1:uWiP4FAmC1srrPcxhHvvQHkiT+I= sha1:l+k/5mIdm81XNLd1m9UXAMzg6/U= Xref: csiph.com comp.misc:26437 Ivan Shmakov writes: >>>>>> On 2025-01-16, Salvador Mirzo wrote: > > > I suspect I imagine wrong how things actually work. I thought > > perhaps there would be a command line such as ``lpr --pages 7-14''. > > As has already been pointed in this thread, CUPS, a fairly > common choice for a printer spooler in GNU/Linux systems, > provides lp(1) command that does have just such an option. Thanks for the information. It turns out I'm not being able to print two-sided-long-edge with CUPS and my Brother HL-L2360DW. I resorted to using /etc/printcap and lpd's lpr (not CUPS's lpr) because I can then set my printer to always do two-sided-long-edge, which is nearly 100% of the way I print. > > Now I believe a program like evince generates a PostScript of > > the pages you asked it to and then sends this complete PostScript > > document of the pages you requested to a pipe or file on disk > > that lpr sends to the printer. > > AIUI, traditional lpd(8) / lpr(1) do require the file to be > preprocessed in such a way before it is submitted for printing, > but even then, they do /not/ require for the file to be > PostScript: it's possible to setup the respective filters to > accept other formats, such as PDF. That's what I did as well. I use a filter called ps2pcl. lp|remote|brother|Brother HL-L2360DW:\ :lp=9100@BRWB052162167A6:\ :if=/usr/local/libexec/ps2pcl:\ :sh:sd=/var/spool/output/lpd:\ :lf=/var/log/lpd-errs: But today I learned that the Brother HL-L2360DW supports PostScript and I was able to set it up that way with CUPS. I just don't use because I never want two-sided-short-edge or one-sided, which is all I can get with CUPS for whatever reason. > > So, if qpdf doesn't do the same, I'm out of luck in terms of > > printing with lpr. But I think I can find a program that takes > > page ranges and transformations like scaling and produces a > > PostScript document that I can send to lpr, so I can use qpdfview > > and use the command line to print stuff out. > > I'm not too familiar with qpdf(1) (and I don't think I've ever > used qpdfview [*]), but it does have a --pages option. E. g.: Turns out qpdfview is a pretty usable PDF viewer and it's the one I'm using the most here. I think qpdfview is the closest thing to SumatraPDF (on Windows), my favorite. > $ qpdf --empty --pages in.pdf 5-8 -- out.pdf > $ qpdf in.pdf --pages . 5-8 -- out.pdf Thanks! That works. > (The second variant preserves the input document metadata, > which isn't probably of much use for printing anyway.) Good to know. Sometimes we produce PDF for screen viewing. > ... A somewhat little-known fact is that once uncompressed, PDF > is largely a text file (perhaps unsurprising, given it comes > from the same company that created PostScript), though employing > byte offsets rather unrestrictedly. > > qpdf(1) has a --qdf option that undoes compressesion and annotates > the file in such a way that the companion fix-qdf program can > fix the byte offsets, at least in certain cases, thus allowing the > PDF file to be edited with a text editor. (Though probably using > a library, such as PDF::API2 for Perl, would be more practical > than trying to, say, adapt sed(1) for automated edits in this case.) You seem to know a lot about PostScript. So here's a question. When I want to print two-sided-long-edge, is that a command included in the PostScript document itself (and then sent to the printer)?