Hello All,
I have a button setup that will bring up a pdf:
//print handout
progname = "xyz.pdf"
dirStr = "directoryPathAsString"
status = RUNSHELLOPEN(progname, "", dirStr)
//print handout
What I would like to do is have adobe reader print the pdf without even displaying the reader window. Has anyone accomplished this? I searched around the forum and also googled to see if there were any parameters I could send adobe readers way but didn't find anything useful.
Thanks,
Brad
Look at RunTextProcess() symbol and see if this meets your needs.
To my knowledge, Adobe will not give you free access to print a PDF without opening Adobe Reader and then printing. It will also leave Adobe Reader running without a way to kill it. You would have to store off the process ID and kill it through command line after the print is complete. Adobe may supply an API through their paid services to do this, though.
I've seen posts online of some people being able to use Foxit PDF viewer to print PDF's through command line or C#; however, then you would need to have Foxit installed on all of your client machines. There are also paid services that do PDF printing as well.
Thanks. This is what I kind of thought from searching around. I was holding out hope that someone had found an easier way to do it.
if i were trying to do this, i would invoke a batch file, that in turn runs a vbscript.
who knows maybe you can system print from a bat file as well.
rough code....
{RUNPROCESS("print.bat",filename,"good","bad")}
bat file: print.bat (called from your button) contents:
C:\windows\syswow64\cscript.exe "print.vbs" %1
script file print.vbs contents:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.GetFile(WScript.Arguments(0))
theFile.InvokeVerbEx("Print")
The bat file and vbs file can be in the logician home directory, or you could call it from a network location, same with the vbscript I suppose.
I haven't tested this, but i believe This will open reader (in the background) print to the default printer and automatically close reader. I know you don't want reader to open, but this will close it. If you really don't want to open reader i think you will need download a third party app and modify the code to call that.
I use very similar code to export/print all chart attachments. It calls various utilities to print different types of attachments to PDFs in one directory.
I at least tested "Right Click|Print" which I think is the same as the InvokeVerb in the code and it does open and in fact close reader automatically.
EDIT: Tested with acrobat pro install, but don't believe the behavior would change for reader
BioPDF does this.
You can send a job to it and it will drop a file to a location. Only trouble is that you have to configure this per user.
incidentally if i look at the registry, the print comment in the right click menu is
"C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Acrobat.exe" /p /h "%1"
bummer, i just tried right click print on a machine with with Reader DC installed, and it left it open....
Even though the command line options for right click print are the same....
So looks like Acrobat Pro will close, but Reader will not.
Looks like 3rd party is only option.