3

All I want is to turn a .txt with a proportional font (monospace/Courier New/Fixedsys/whatever) and fixed column width (80 chars) to be turned into a correct PDF document, so that it can be printed or shared as a PDF.

Requirements:

  1. It must run on the command line (no manual steps).
  2. Must be free of charge.
  3. Must actually work! This last point is very important.

I have tried numerous open source tools for this over the years, although I used to be naive enough to think I could convert HTML with semi-advanced CSS into PDF -- it seems laughable to me now -- whereas my demands are infinitely smaller now, when I have the most basic kind of document in existence: plaintext!

pandoc looked extremely promising, but after pouring countless hours into it, trying every "PDF converter engine" it supports, and a million different variations of the parameters, it simply would never honor my choice of font, instead falling back on some default font which completely messed up the resulting PDF. As such, I must conclude that it's yet another broken tool which doesn't at all keep its promise to convert plaintext to PDF.

This seems like such a basic, common task that I almost expected it to be provided by the OS rather than some third-party software, but apparently not...

Although not a requirement, it's a plus if it also runs on other OSes.

  • 3
    Welcome to ServerFault. You specify "proportional" font, and then you go on to mention the word "monospace", along with two monospace fonts. Can you clarify? (Given the current answer, it might not matter for you, but it could affect the applicability of this question/answer pair to future readers.) – Doug Deden Jan 27 '20 at 16:53

1 Answers1

5

In Windows 10 run ps command:

Get-Content "textfile.txt" | Out-Printer "Microsoft Print to PDF"
batistuta09
  • 8,981
  • 10
  • 23