[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 19:21:39 -0600, David Wright wrote:

> On Mon 08 Jan 2018 at 18:18:33 (+0000), Brian wrote:
> > 
> > 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.

I am not attempting to dissuade anyone from using paps but trying to
explore why what appears to be a relatively simple process (text to PDF)
has so few utilities. Without a UTF-8 requirement we are awash with
Postscript programs, but not so with direct conversion to PDF. Having
said that, I have no deep understanding of either the PostScript or PDF
format, so perhaps it is more difficult than I imagine; especially when
it comes to producing an output with, for example, columns, headers etc.

However, there are utilities which can help with preprocessing a text
file beforehand.

As a UTF-8 Debian alternative to txt2pdf:

Create $HOME/.config/fontconfig/fonts.conf with the contents

  <?xml version='1.0'?>
  <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>

(Is there anything better than FreeMono's UTF-8 glyph coverage?)


  CHARSET=utf-8 /usr/lib/cups/filter/texttopdf 1 1 1 1 1 < text.txt> > out.pdf

out.pdf is not searchable, so continue with

  pdftocairo -pdf out.pdf searchable.pdf

A bonus is that searchable.pdf is about seven times smaller than out.pdf.


Reply to: