Web lists-archives.com

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




On Wed 10 Jan 2018 at 17:13:09 +0100, tomas@xxxxxxxxxx wrote:

> On Wed, Jan 10, 2018 at 09:38:47AM -0600, David Wright wrote:
> 
> And to be fair, results can be pretty exciting, depending on the
> actual file content...
> 
> I would go with a2ps, too, btw.
> 
> Downside is that it does the panoramic tour via PS and thus generates
> fairly hefty PDFs.

With plain text files as an input?

brian@desktop3:~$ a2ps /etc/mime.types -o output1.ps
[/etc/mime.types (plain): 15 pages on 8 sheets]
[Total: 15 pages on 8 sheets] saved into the file `output1.ps'
[73 lines wrapped]

brian@desktop3:~$ ps2pdf output1.ps

brian@desktop3:~$ txt2pdf.py /etc/mime.types -f /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf -o output2.pdf
Writing '/etc/mime.types' with 80 characters per line and 60 lines per page...
PDF document: 14 pages

brian@desktop3:~$ /usr/sbin/cupsfilter /etc/mime.types > output3.pdf

brian@desktop3:~$ ls -l
-rw-r--r-- 1 brian brian  28853 Jan 10 18:58 output1.pdf
-rw-r--r-- 1 brian brian  66557 Jan 10 18:58 output1.ps
-rw-r--r-- 1 brian brian  36221 Jan 10 18:58 output2.pdf
-rw-r--r-- 1 brian brian 219186 Jan 10 18:59 output3.pdf

output3.pdf contains the complete DejaVuSansMono glyph set.

The finger is often pointed at ps2pdf as a file bloating command.
Unjustifiably, it would seem, in this case. A counter example with a
text file?

-- 
Brian.