Need PDF Printing to Printer utility

Lee W, MVP
Lee W, MVP used Ask the Experts™
on
I need a program or utility (free preferrably, paid if it's easy to setup and use) that will print PDFs automatically.

Every night, a client receives dozens to hundreds of PDFs via SFTP from one of their clients.  These documents need to be printed (unfortunately).  They want a system that can either be scripted or set to check folders (and sub folders) for new files and print them automatically throughout the night.

I've done some research and found an AutoIT compiled script but it doesn't work well because some of these pages are being (incorrectly) identified as 8.5x13 when the utility attempts to print them (printing them with Acrobat (and reviewing the print options) indicates they are 8.5x11).  And of course, when the page size changes, the job hangs and stops all other jobs until you fix it...

So I need something that can do this intelligently... shrink the page to fit, ignore the page size and just print to whatever paper is present (cutting off excess - which will almost never actually happen), etc.

Anyone have any suggestions?

I'm willing to script a utility that WORKS so it doesn't have to do everything... but if someone has a product designed to monitor (a) folder(s) and print the contents, including PDFs, that's great too.

I don't think I can use Acrobat because it wants to leave the program open after printing... 900 instances of acrobat would be a problem in the morning...

And using a script to subsequently kill acrobat isn't practical... some of these print jobs could be small - a few pages... others could be hundreds of pages and unless there's a way to programmatically tell when the job is done, at least fully spooled, I can't plan on killing the process.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Lee W, MVPTechnology and Business Process Advisor
Most Valuable Expert 2013

Author

Commented:
Testing a solution using Ghostscript and gsprint now... looking promising.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
First, I have not done this.

Looking at this to assist you, have you seen the following - free for non commercial use, so easy to try. Batch prints more than just PDF.

https://www.print-conductor.com/articles/batch-print-pdf
Top Expert 2015

Commented:
I think everything you're looking for can be done using VBS then schedule the script to run in the task scheduler.

It won't be hard to program a VB script to:

1.  Check the folder and subfolders for new file
2.  Print the file
3.  Record and/or move each successfully printed file to a different folder so it doesn't get reprinted

I am sure you can filter the extension in VBS to only print PDF files.

As for the PDF reader to use, try Sumatra PDF, it's a standalone executable.

I saw VBS example of using Sumatra to print the PDF:

filename = "C:\path\to\some.pdf"
Set sh = CreateObject("WScript.Shell")
sh.Run "sumatrapdf.exe -print-to-default """ & filename & """", 0, True

Under the printing options you can also have it to not scale, shrink and fit, and silent printing:
 https://www.sumatrapdfreader.org/docs/Command-line-arguments.html

Not an easy solution but highly flexible.
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Hi Lee,
What should be done with each file after it is printed? Delete it? Move it to an "already printed" folder? Leave it in the "watched folder" but develop a way to know that it has already been printed? Something else? Regards, Joe
Distinguished Expert 2017

Commented:
Lee,

The following has a powershell example.
https://gregcaporale.wordpress.com/2012/01/18/powershell-to-print-files-automatically/

Much also depends on the Printer's options,

IMHO, it is not a wise choice to delete.

I think there was a discussion and a tool that can monitor a folder for new files, that can then run commands....

https://www.raymond.cc/blog/3-portable-tools-monitor-files-folders-changes/
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Hi Arnold,
IMHO, it is not a wise choice to delete.
I agree, but some users want it, as it is time-consuming to go back and do the deletions manually at a later time. For example, discussed at this EE thread:
https://www.experts-exchange.com/questions/29072521/Combine-PDFs-into-one-file-in-multiple-folder.html#a42396207

Of course, it is critical that it be an option...and not the default option.
discussion and a tool that can monitor a folder for new files, that can then run commands
Also discussed at this EE thread:
https://www.experts-exchange.com/questions/29089593/Monitor-a-folder-for-any-file-changes-within-it.html

Regards, Joe
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Lee mentioned an AutoIT script in his initial post. I don't know AutoIT, but I do know AutoHotkey (which is a fork of AutoIT) and can probably provide an AutoHotkey solution, but I've been waiting for answers to my questions in the #a42642528 post. I think that an AutoHotkey script that watches the folder and prints the incoming PDFs via a command line (such as the /t option on AcroRd32.exe) would work nicely. Regards, Joe
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Testing a solution using Ghostscript and gsprint now... looking promising.
Hi Lee,
It's been more than five months since that last post of yours. I'm wondering how your promising-looking test turned out and/or if you're still interested in this question. Regards, Joe

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial