Topic Options
#16999 - 01/10/06 06:17 AM print pdf
lls Offline
Junior Member

Registered: 07/12/05
Posts: 4
Loc: UK
Could someone be kind enough to give me the vb syntax to print a pdf file.

I can do it from a .bat file.

call "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" /t "\\domain\public\WatchProcessing\CopyInv\CopyInv.pdf" "\\domain\PRN-001" "Oki B6100(PCL)" "PRN-001"

But lost with VB
Thanks

Top
#17000 - 01/10/06 08:20 AM Re: print pdf
John Dalzell Offline
Junior Member

Registered: 01/08/04
Posts: 25
Not sure if this is what you want to do exactly but this should work with compiled VB. I have not worked enough with VB script to know if this will work using VBS.

Code:
Dim dblRc As Double  

dblRc = Shell("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" /t "\\domain\public\WatchProcessing\CopyInv\CopyInv.pdf" "\\domain\PRN-001" "Oki B6100(PCL)" "PRN-001", vbMinimizedNoFocus)

Top
#17001 - 01/10/06 08:39 AM Re: print pdf
John Dalzell Offline
Junior Member

Registered: 01/08/04
Posts: 25
Sorry, If you need to use embedded quoted strings use an extra double quote as VB uses a double quote to delineate string literals. The file path referencing ACRORD32.exe and probably the /t and pdf path should not be quoted: You might want to try something like this:

Code:
  
Dim dblRc As Double  dblRc = Shell("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe /t \\domain\public\WatchProcessing\CopyInv\CopyInv.pdf \\domain\PRN-001 ""Oki B6100(PCL)"" ""PRN-001""", vbMinimizedNoFocus)

Top
#17002 - 01/10/06 09:46 AM Re: print pdf
lls Offline
Junior Member

Registered: 07/12/05
Posts: 4
Loc: UK
Thanks for that but I need it in VBScript as, dim as double doesn't work.

Top
#17003 - 01/10/06 11:01 AM Re: print pdf
John Dalzell Offline
Junior Member

Registered: 01/08/04
Posts: 25
OK, try this within your VB script:

Code:
dim Wshshell, retcode
set Wshshell = CreateObject("WScript.Shell")
retcode = Wshshell.run ("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe /t \\domain\public\WatchProcessing\CopyInv\CopyInv.pdf \\domain\PRN-001 ""Oki B6100(PCL)"" ""PRN-001""", 1, TRUE)
set wshshell = nothing
The "1" after the first paramater command is the intWindowsStyle parameter and in this case, indicates that we want a new windows started and displayed.
The possible values for intWindowsStyle are:

0 - Hides the window and activates another window
1 - Activates and displays the window
2 - Activates and displays the windows as minimized
3 - Activates and displays the window as maximized
4 - Activates the windows and displays it in it's most recent size and position
5 - Activates the window and displays it in it's current size and position
6 - Minimizes the window and activates the next top-level window
7 - Displays the windows as a minimized window
8 - Displays the windows in it's current state
9 - Activates and displays the window
10 - Sets the show state based on the state of the program that started the application

The next parameter, which we set to TRUE is the bWaitOnReturn parameter.
The possible values for bWaitOnReturn are:

TRUE - Causes the VBScript to wait until the command completes before the next line of the script is executed.
FALSE - The VBScript will continue with the next line in the script without waiting for the command to complete.

You probably do not want to specify TRUE, that may hold up all of planetwatch
You may need to try some of the other values for intWindowsStyle

Top