[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to create a PDF-Printer from the command line



On Mon 08 Jan 2018 at 18:18:33 (+0000), Brian wrote:
> On Mon 08 Jan 2018 at 09:35:36 +0000, Curt wrote:
> 
> > On 2018-01-08, David Wright <deblis@lionunicorn.co.uk> wrote:
> > >> 
> > >> Which txt2pdf? I tried the DFSG free one at
> > >> 
> > >> https://github.com/baruchel/txt2pdf
> > >> 
> > >> Not in Debian, AFAICT, but download, put in /usr/local/bin and install
> > >> python-reportlab. Gives searchable PDFs, fonts can be selected more
> > >> easily than with cupsfilter or cups-pdf and it has UTF-8 support. Looks
> > >> useful.
> > >
> > > Indeed. It seems a lot faster than paps+ps2pdf too. I can see myself
> > > using this, though I'll keep my paps function as well, as it appears
> > > to be able to make substitutions for missing glyphs. It's handy to
> > > have a function that prints *something* at every position (except
> > > the strip at 0x80), with those little blobs containing 4 hex chars
> > > where there's no glyph. paps also does columns.
> > >
> > > The default fault in txt2pdf is Courier→Nimbus Mono AFAICT, which is
> > > very limited.

default.png attached¹. The majority of Unicode characters appear as
unadorned blobs.

> > > The unifont TTF font has far more characters, but
> > > the quality is very poor (deliberately, but looks like a bitmapped font).

unifont-ttf.png attached. AIUI the entire BMP (Basic Multilingual
Plane) is contained in less than 4MB and illustrated in a 2MB .BMP
(DIB) file, so the quality is, as I said, deliberately poor. Try
$ display /usr/share/fonts/opentype/unifont/unifont.ttf 

> > > I also haven't figured out line-numbering: I'll have to study the script.
> > > Searchability is a useful extra (I'm used to just searching the original
> > > text source file).
> > 
> > It seems very swift. I tried line-numbering with the '--line-numbers'
> > argument, but got no line numbers (which is not what I was expecting).
> 
> A possible bug. Not to worry; preprocess:
> 
>   pr -n text.txt
>   
> > Then I tried the '--page-numbers' argument, expecting to see page
> > numbers (and I did, centered at the bottom).
> 
> Ditto.
> 
> > You can change the default font ('--font' or '-f' <full-path-to-ttf>,
> > but I'm sure you know that already).
> 
> Unlike David Wright, I've not noticed the font quality to be poor when
> the magnification ability (left click with the mouse) of gv is used to
> examine characters in the PDF.

What I was using with paps (and its maximum Unicode coverage when
diagnostic printing) is FreeMono, which appears to substitute unifont
characters where it needs to: freemono.png attached. This shows the
font itself, some hex blobs, and some unifont substitutions.
So *most* of a typical file will be printed with the quality of
$ display /usr/share/fonts/opentype/freefont/FreeMono.otf

Commenting on your other post, yes, it *would* be nice if paps were
papdf, but I merely have    | ps2pdf - -   at the end of the bash
function that sets the default font and margins etc to suit my
printer. So being Unicode-aware is far more important to me than
PS output.

¹ attachments are scrot screenshots of xpdf set to 600%, which limits
their crispness.

Cheers,
David.


Reply to: