OT: Recommendation for a PDF Converter for use with Winbatch?

Started by mhall, November 04, 2017, 04:05:51 PM

Previous topic - Next topic

mhall

Hey All,

I am currently looking for a recommendation for a method of converting text files to PDFs which can be run "silently" via command line.

The use case is converting simple text files into PDFs for emailing to customers.

I'm POSTING the text data to Webbatch on our server where I save the data as a text file and would then like to convert it to a PDF which I can later email or upload to our public  (static/non-Webbatch) site for manual download by customers. Volume is not high - a few hundred documents run in a batch once a week or so. The text documents are small - 10K would be a very large document for this scenario.

I did some searching in the Tech Database, and even saw that someone had once upon a time written a Ghostscript extender, but the links are no longer valid.

As these are simple text files and MS includes PDF converter in Windows these days, I tried the print() function, but that calls up a print dialog.

If there is a variation on print that *doesn't* involve a dialog, I would be happy to hear about it.

Thanks for any ideas!

~Micheal


JTaylor

Copied this out of a forum....can't vouch for it but for what it is worth....


          LibreOffice / OpenOffice as well as most other word processors (Abiword) can do this quite easily.

          There is a little utility called unoconv that uses the LibreOffice code base to do file format conversions on the command line. It can read and write any combination of formats that LibreOffice can and makes it very easy to do things like doc to pdf conversions on the command line. Simple txt to pdf would be easy for it.


Jim

stanl

CutePDF can be called from WB, but that is just another app to manage. I think at one point there was a WB post about using Word with VB to save text as PDF.

td

Quote from: mhall on November 04, 2017, 04:05:51 PM
Hey All,

I am currently looking for a recommendation for a method of converting text files to PDFs which can be run "silently" via command line.

The use case is converting simple text files into PDFs for emailing to customers.

I'm POSTING the text data to Webbatch on our server where I save the data as a text file and would then like to convert it to a PDF which I can later email or upload to our public  (static/non-Webbatch) site for manual download by customers. Volume is not high - a few hundred documents run in a batch once a week or so. The text documents are small - 10K would be a very large document for this scenario.

I did some searching in the Tech Database, and even saw that someone had once upon a time written a Ghostscript extender, but the links are no longer valid.

Checked the link to the Ghostscript extender and it is most certainly valid.  The compressed extender file is present on the server as well.  Not sure why you would have a different experience.

Quote
As these are simple text files and MS includes PDF converter in Windows these days, I tried the print() function, but that calls up a print dialog.

If there is a variation on print that *doesn't* involve a dialog, I would be happy to hear about it.

Thanks for any ideas!

There is always Pdfcreator.  Here is the Tech Database link:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Samples~from~Users+wbconvert2pdfcreator.txt

Pdfcreate has a COM Automation interface that can be used in a WinBatch script.

And here is link to a "pure" WinBatch solution that reportedly does not rely on any third party applications:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Samples~from~Users+Text~to~PDF~UDF.txt
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

mhall

Hey thanks Tony!

I'll check that Ghostscript link again - It was coming up URL not found for me from the Tech DB articles I was looking at and even a Google search didn't turn anything up at the time.

In fact, I wasn't getting much of anything in a TechDB search - a couple of links.

Probably I just screwed it up.  :o

The PDFCreator option is very interesting as I already have that installed, so I'll have a look there too.

Thanks Jim and Stan for the references - I'm sure I'll be able to work something out with all of this.

Regards,
Micheal

td

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

mhall

Ah!, I know what I was looking at. I actually did see that article.

The extender link itself works fine (I didn't see it the first time I looked at the article, to be honest), but the link to the Ghostscript interpreter, which the article says is required, is the broken one. I didn't get much further than that before bouncing off and beginning other searches. I completely failed at just going to the Ghostscript site to look around.

I did search the TechDB for more references, but I think I goofed on my search settings and didn't see that they were limited to the "current area".

Some easy poking at Ghrostcript.com site revealed what I think to be is needed - the interpreter mentioned in the Tech article. (The link to the download page is: https://www.ghostscript.com/download/  ... go figure ).

I'm usually better at finding things than that.

Thanks for the kick in the head.

~Micheal


mhall

Just wanted to give a quick report ... that UDF for direct conversion for text to PDF is *exactly* the sort of thing I was looking for.

It's very fast and my little documents are exactly what it looks like it was made for - text docs, formatted with spaces, using a monospaced font.

Thanks for pointing that out Tony. That solves my problem perfectly. :)

~Micheal