topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 4:33 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Looking for freeware command line text to PDF  (Read 12449 times)

AzureToad

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 97
    • View Profile
    • Read more about this member.
    • Donate to Member
Looking for freeware command line text to PDF
« on: August 02, 2019, 01:54 PM »
I found TXT2PDF referenced in a couple places, including this DonationCoder post, and I tried pulling a copy from VeryPDF.com, but was blocked (unsafe?).

Does anyone have experience with a freeware CLI text-to-PDF converter that can be run from a Windows batch script? And a URL to a "safe" download would be fab!

Lintalist

  • Participant
  • Joined in 2015
  • *
  • Posts: 122
    • View Profile
    • Lintalist
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #1 on: August 02, 2019, 04:33 PM »

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #2 on: August 02, 2019, 05:54 PM »
^ Pandoc needs 3'rd party application, before it can create pdf.

AzureToad

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 97
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #3 on: August 02, 2019, 05:57 PM »
^ Pandoc needs 3'rd party application, before it can create pdf.
Yeah, I'm running the Tex Live Installer now, even as we speak.  Holy smoke, about 1/3 of the way through install and it's only been...  let's see... an hour and 5 minutes!   :huh: 
I don't think I've EVER seen an install take this long!

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,939
    • View Profile
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #4 on: August 02, 2019, 07:23 PM »
Pandoc can be quite daunting to get the conversion right. Lots of features and options to choose from. MikTex is another software piece to try with Pandoc. Was a 200MByte download at the time, but worked well enough for what I needed it to do.

At least it wasn't an online installer, which can be affected by anything and waste a lot of time.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #5 on: August 03, 2019, 08:05 AM »
As long as your text is formatted beforehand, (it will truncate lines that don't fit your chosen output dimensions), then txt2pdf, (just another of many), is lightweight and fast.

TXT2PDF
TXT2PDF is a command-line tool for encoding ASCII as PDF. See the "ReadMe" file included with the zip for options and usage.

Example of calling TXT2PDF:

   txt2pdf -i"C:\temp\my ASCII file.txt" -o"C:\temp\pdfout.pdf" -w17 -h11
In this example, txt2pdf reads a file ("my ASCII file.txt") and writes it to a pdf ("pdfout.pdf"). The "-w" switch defines the page width as 17 inches; the "-h" switch defines the page height as 11 inches. Note that there are no spaces bewteen the flags and the associated parameters. See the ReadMe file for details.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,190
    • View Profile
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #6 on: August 03, 2019, 09:25 AM »
As long as your text is formatted beforehand, (it will truncate lines that don't fit your chosen output dimensions), then txt2pdf, (just another of many), is lightweight and fast.

TXT2PDF
TXT2PDF is a command-line tool for encoding ASCII as PDF. See the "ReadMe" file included with the zip for options and usage.

Example of calling TXT2PDF:

   txt2pdf -i"C:\temp\my ASCII file.txt" -o"C:\temp\pdfout.pdf" -w17 -h11
In this example, txt2pdf reads a file ("my ASCII file.txt") and writes it to a pdf ("pdfout.pdf"). The "-w" switch defines the page width as 17 inches; the "-h" switch defines the page height as 11 inches. Note that there are no spaces bewteen the flags and the associated parameters. See the ReadMe file for details.

That's the same name as the utility quoted in the original post.  Is it the same utility?  Or just another by the same name?

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #7 on: August 03, 2019, 09:55 AM »
Two completely different products:

08/03/2019  09:10 AM            25,130 txt2pdf.zip
08/03/2019  10:52 AM           852,893 verypdf-free-txt2pdf.exe

Neither is blocked for me, and VirusTotal does not complain about either.
vi vi vi - editor of the beast

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Looking for freeware command line text to PDF
« Reply #8 on: August 03, 2019, 03:13 PM »
That's the same name as the utility quoted in the original post.  Is it the same utility?  Or just another by the same name?

The OP references a post by me which includes a quote by jity2 which mentions "txttopdf.exe" - different name, (txt2pdf not mentioned in that whole thread - typo or mis-link?).

There are multiple versions of executables called txt2pdf including this one from Sourceforge but it puts up a requester when it finishes which makes it unsuitable for CLI batch use.

The one I linked is just a search result, (that I tested against a few files), that lets you also specify a few output options that should cover the majority of cases for simple text conversion.  As a bonus its website tested clean against VirusTotal.

In theory, you could do it all using PowerShell, for example, this code from TechNet, but I could only get it to produce blank PDFs and after staring at it for 30 minutes and not being able to work out what the hell was happening, decided it was easier to use the results of the Google search :-\ ... why reinvent the wheel?