2016-11-07 13 views
-2

.batと.vbsを使用します。 1000個のPDFのそれぞれから最初のページを印刷する方法は?私が見つけた各ページの最初のページを印刷します。

ザ・唯一の作業溶液は、次のとおりです。

Option Explicit 

Const FILE_TO_PRINT = "n:\xxx\xxx\xxx\xxx\xxxx.PDF" 
Dim shl 
Dim fldr 
Dim files,file 

Set shl = CreateObject("Shell.Application") 
Set fldr = shl.Namespace("n:\HEAT06\BAA Cards\66712\20161103\") 
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 

それが仕事をして、しかし、私は最初のページだけを必要とするとき、それは、文書全体を印刷しますです。

+0

AcrobatにはWord.Applicationのようなインターフェイスがありますか? http://www.visualbasicscript.com/vbs-to-print-three-pages-from-ms-word-m70929.aspx – lit

+0

どのプログラムがPDF印刷に使用されていますか?アドビリーダー? – ReFran

+0

@ReFran Adob​​e Acrobat 11 Proを使用する – Denis

答えて

1

VBSを添付しました。数年前に書きましたが、これをドロップしたすべてのファイルの最初のページがデフォルトのプリンタに印刷されます。必要なものに変更することができます。あなたがファイルをマークした方法でソートされた印刷物を得るために、&のドロップでそれを使用する場合は、のマーク付きファイルを最初または最後のファイルからドラッグする必要があることに注意してください。 HTH、Reinhard

'//Print first page of pdfs 

set WshShell = CreateObject ("Wscript.Shell") 
set fs = CreateObject("Scripting.FileSystemObject") 
Set objArgs = WScript.Arguments 

if objArgs.Count < 1 then 
    msgbox("Please drag a file on the script") 
    WScript.quit 
end if 
    'contact Acrobat 
Set gApp = CreateObject("AcroExch.App") 
gApp.show 'comment or take out to work in hidden mode 

    'open via Avdoc and print 
for i=0 to objArgs.Count - 1 
    FileIn = ObjArgs(i) 
    Set AVDoc = CreateObject("AcroExch.AVDoc") 
    If AVDoc.Open(FileIn, "") Then 
     Set PDDoc = AVDoc.GetPDDoc() 
     Set JSO = PDDoc.GetJSObject 
     jso.print false, 0, 0, true 
     gApp.CloseAllDocs 
    end if 
next 

gApp.hide : gApp.exit : Quit() 
MsgBox "Done!" 

Sub Quit 
    Set JSO = Nothing : Set PDDoc = Nothing : Set gApp =Nothing : Wscript.quit 
End Sub 
関連する問題