Re: How to create a PDF-Printer from the command line
On Thu 18 Jan 2018 at 12:40:10 (+0000), Brian wrote:
> On Thu 18 Jan 2018 at 09:44:51 +0000, Curt wrote:
> > On 2018-01-17, Chris Ramsden <firstname.lastname@example.org> wrote:
> > > On 17/01/18 21:42, Ben Caradoc-Davies wrote:
> > >> On 18/01/18 10:37, Joel Wirāmu Pauling wrote:
> > >>> Works fine for txt, although as it rasterizes things it's not going to be
> > >>> optimized for size.
> > >>
> > >> Yes, typically, but for large fonts and low resolution outputs with few pages, rasterised pages may be smaller.
> > >>
> > >> Kind regards,
> > >>
> > > If I feed it a text file, it gives me an error:
> > >
> > > convert: improper image header `self_spam.txt' @ error/txt.c/ReadTXTImage/439.
> > >
> > > What's the trick to making it work with a text file as input?
> > I ran into the same error (fixed in later versions, apparently, though I
> > am in the dark as to what version you are using and how late is later).
> > I read an explicit
> > convert text:mytext.txt mytext.pdf
> > works.
> > But it doesn't work here.
> > Also: all roads lead to Rome, but some may be more suitable for wagons than others.
> As is obvious, I hadn't realised imagemagick converted text to pdf.
> However, the command you give works for me on stable and unstable.
> It gives unsearchable PDFs.
It serves more as a reminder of convert's way of specifying the
contents of the file than much else. Adding -font unicode also dredges
up the awful-looking ttf font. But given that the PDF produced is so
blurry, that font is probably no worse looking than any other.
The PDF is unsearchable because it's really just an image wrapped in
a PDF container (like the output from some scanners). Being an image,
there's no concept of wrapping long lines either.
I can't really be bothered to figure out what's missing on those
systems of mine that say:
$ convert -font unifont text:/etc/default/grub /tmp/grubby.pdf
convert: not authorized `/etc/default/grub' @ error/constitute.c/ReadImage/412.
convert: no images defined `/tmp/grubby.pdf' @ error/convert.c/ConvertImageCommand/3210.