4

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.

4

2 回答 2

5

我认为您不能单独使用 VBScript 打印 PDF。但是,SumatraPDF应该能够做你想做的事。-print-to-default它是一个独立的可执行文件,您可以使用以下选项将 PDF 打印到默认打印机:

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

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

有关详细信息,请参阅手册。

于 2013-10-23T13:19:54.440 回答
1

这个怎么样:

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

对象需要文件所在的Shell.Application文件夹,常量FILE_TO_PRINT需要文件的完整路径。

InvokeVerbEx("Print")Foxit Reader 或 Acrobat 等相关程序中打开文件,并将其发送到默认打印机。

它与在资源管理器中右键单击文件并单击“打印”具有相同的效果

于 2013-10-23T13:14:53.060 回答