Link to home
Start Free TrialLog in
Avatar of bagirex
bagirex

asked on

Batch print PDF files from VB

Hi,
I want to be able to silently print batch pdf files from VB using user's default printer.
Using shell "AcroRd32 -p " command opens up print dialog that I don't need, and it can print only one pdf.


Thanks
ASKER CERTIFIED SOLUTION
Avatar of vinnyd79
vinnyd79

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richie_Simonetti
I did a little example here:
http://www.angelfire.com/realm/vb-shared/pdf_print.xls
What you need to avoid dialog box is using /T modifier instead of p.
hi, any progress on this? some feedback would be nice.
Cheers
Avatar of bagirex
bagirex

ASKER

I am using WIN2K, Vb6, Acrobat 6.0
Sorry about being late on this.

vinnyd79,
Thanks, it is working except Acrobat window is left open.
How to close it?
Will it work on other that WIN platforms?

Richie_Simonetti,

in modmain
Do
    ' Please check that caption of acrobat is correct,
    ' otherwise this loop will never ends.
    l = FindWindow(vbNullString, "Acrobat Reader - [" & filename & "]")
Loop While l = 0

When I've commented out all but
ShellExecute 0, "print", "C:\Program Files\Adobe\Acrobat 6.0\Reader\Acrord32.exe /t " & filename, vbNullString, vbNullString, vbHide
it didn't work either.

It kept looping.
Avatar of bagirex

ASKER

Richie_Simonetti,

Just read
    ' Please check that caption of acrobat is correct,
comment more carefully. Is it good idea to find acrobat instance by it's window title?
Might be differet with different versions.
Of course, you could do that way:
classname for acrobat is (at least 5.0) is:
Afx:400000:8: 10011:0:a510219
by the way, i misread your comment, it IS searching by its window title.
Avatar of bagirex

ASKER

At least the good news is Acrobat Reader allows only one running instance.
Afx:400000:8: 10011:0:a510219 for classname didn't work. Mine is Adobe 6.0
Well, if classname doesn't works, we have to moveback to findwindow api.
Please, check how acrobat show its caption with version 6.0
Classname for version 6.0.0 in "AdobeAcrobat"
Well, since only one instance is allowed, use code from vinnyd, just replace p modifier with t modifier.
Maybe you could call shellexecute with full path to acrobat exe only the first time and others calls to print other docs should use " /t " & filename as lpFile parameter (just a guess)
Avatar of bagirex

ASKER

Richie,

1.  How do you find out classname for Adobe versions? I checked my registry and couldn't find it
2. Vinnyd doesn't use any modifier. It uses only 'print' , which doesn't have modifiers!?

thanks
1) there is a tool that comes with Visual studio called Spy, you could use it to know the class name from every window. Just moving the cursor over it.
2) Modifiers were hard to find for me but, as long as i know, using T as modifier, it doesn't shows you dialog box.
Hi, any progress on this?