home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.misc      General topics about computers not cover      21,759 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 20,454 of 21,759   
   Ivan Shmakov to All   
   Re: terminal only for two weeks   
   23 Jan 25 19:33:36   
   
   From: ivan@siamics.netREMOVE.invalid   
      
   >>>>> 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.   
      
    > 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.   
      
    > 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.:   
      
   $ qpdf  --empty --pages in.pdf 5-8 -- out.pdf   
   $ qpdf  in.pdf --pages . 5-8 -- out.pdf   
      
   	(The second variant preserves the input document metadata,   
   	which isn't probably of much use for printing anyway.)   
      
   	... 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.)   
      
       [*] Given a choice, I tend to prefer HTML.  If the document I'm   
   	interested in is only available in a PDF version, I tend to   
   	use pdftotext(1).  If that fails to produce a legible version,   
   	I resort to Zathura, preferring it mostly for its UI.   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca