Question

Is it possible to print a pdf document to the default printer inside of vbscript or from the command line without AcroRd32.exe?

Ideally if would be nice to just send the pdf to printer and not need another program.

  • or -

Is there a 3rd party .exe program which can print the pdf without a dialogue and without opening and without showing in the Windows taskbar?

The .exe needs to be standalone (so a windows install process is not required).

I am ok paying up to $100 for the .exe as long as it can be distributed inside of another application. Free is also great.

This has me stumped.

Was it helpful?

Solution

I don't think you can print PDFs with VBScript alone. However, SumatraPDF should be able to do what you want. It's a standalone executable and you can print PDFs to the default printer using the -print-to-default option:

filename = "C:\path\to\some.pdf"

Set sh = CreateObject("WScript.Shell")
sh.Run "sumatrapdf.exe -print-to-default """ & filename & """", 0, True

See the manual for more details.

OTHER TIPS

How about this:

Option Explicit

Const FILE_TO_PRINT = "C:\full\path\to\your\file.pdf"
Dim shl
Dim fldr
Dim files,file

Set shl = CreateObject("Shell.Application")
Set fldr = shl.Namespace("C:\full\path\to\your\")
Set files = fldr.Items


For Each file in files
  If LCase(file.Path) = LCase(FILE_TO_PRINT) Then
    file.InvokeVerbEx("Print")
  End If

Next

Set shl = Nothing
Set fldr = Nothing
Set files = Nothing
WScript.Quit

The Shell.Application object needs the folder that your file is in, and the constant FILE_TO_PRINT needs the full path to the file.

The InvokeVerbEx("Print") opens the file in the associated program like Foxit Reader or Acrobat, and sends it to the default printer.

It has the same effect as right-clicking a file in explorer and clicking 'Print'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top