PDA

View Full Version : OT: Printing Existing PDFs..



britk9
6-Sep-2005, 07:14 AM
Archie,

(Sorry, I deleted the original thread)

The following is the a VB script that a business acquaintance sent me that
will print an existing PDF file to the default printer. (I tested it on an
existing PDF file and it indeed does work.)

===================
set shellApp=createobject("shell.application")
shellApp.ShellExecute "d:\temp\sample.pdf",,,"print",7
===================

According to this fellow, the following can be added to the above with VB
script.....

1. Open "select printer" dialog (doable from a vbs)
2. Set this selected printer to be the default printer (doable from vbs)
3. Print PDF as in above sample to the default printer
4. Restore the original default printer (doable from a vbs)

===================

I know pretty much nothing about VB so hopefully you or someone on this NG
can add the above VBS and post it for all. (I'd ask my acquaintance to do
this but it would be chargeable. If no one here can do the VBS, let me know
and I can inquire as to the charge.)

HTH,
Mike

Marco
7-Sep-2005, 11:30 PM
Mike,

I did exactlly that from a VDF program a couple of months ago. I found
that this does not work relyable.
When a batch of documents was processed, with all different printers,
it ended all up on the first one.
It seems like that the shell execute does not get executed
immediately. If your program already set another default printer you
are in trouble...

I solved it by doing the following:
Move '"C:\Program Files\Adobe\Acrobat
6.0\Reader\acrord32.exe"' To sAcrobat
Move 'HP LaserJet 1022n' To sDriver
If (sPrinterQueName = 'PRN-000452') Move 'IP_172.30.0.172'
To sPort
If (sPrinterQueName = 'PRN-000453') Move 'IP_172.30.0.173'
To sPort
If (sPrinterQueName = 'PRN-000454') Move 'IP_172.30.0.174'
To sPort
If (sPrinterQueName = 'PRN-000455') Move 'IP_172.30.0.175'
To sPort
If (sPrinterQueName = 'PRN-000456') Move 'IP_172.30.0.176'
To sPort
If (sPrinterQueName = 'PRN-000457') Move 'IP_172.30.0.177'
To sPort
If (sPrinterQueName = 'PRN-000458') Move 'IP_172.30.0.178'
To sPort
Runprogram Background sAcrobat (' /t "' - sFilename - '"
"' - sPrinterQueName - '" "' - sDriver - '" "' - sPort - '"')

I know this should have been done cleaner, but I was in a hurry
changing it from the default printer mechanism.

ps It seems that the /t option is not supported in acroread 7, so use
5 ot 6.

Cheers,
Marco





On Tue, 6 Sep 2005 08:14:22 -0400, "britk9" <britk9@bellsouth.net>
wrote:

>Archie,
>
>(Sorry, I deleted the original thread)
>
>The following is the a VB script that a business acquaintance sent me that
>will print an existing PDF file to the default printer. (I tested it on an
>existing PDF file and it indeed does work.)
>
>===================
>set shellApp=createobject("shell.application")
>shellApp.ShellExecute "d:\temp\sample.pdf",,,"print",7
>===================
>
>According to this fellow, the following can be added to the above with VB
>script.....
>
>1. Open "select printer" dialog (doable from a vbs)
>2. Set this selected printer to be the default printer (doable from vbs)
>3. Print PDF as in above sample to the default printer
>4. Restore the original default printer (doable from a vbs)
>
>===================
>
>I know pretty much nothing about VB so hopefully you or someone on this NG
>can add the above VBS and post it for all. (I'd ask my acquaintance to do
>this but it would be chargeable. If no one here can do the VBS, let me know
>and I can inquire as to the charge.)
>
>HTH,
>Mike
>
>

britk9
8-Sep-2005, 06:19 AM
Marco,

Thanks!

Best Regards,
Mike

"Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
news:iafvh1lidm6dh0aog6ulepj4pn41h60t1k@4ax.com...
> Mike,
>
> I did exactlly that from a VDF program a couple of months ago. I found
> that this does not work relyable.
> When a batch of documents was processed, with all different printers,
> it ended all up on the first one.
> It seems like that the shell execute does not get executed
> immediately. If your program already set another default printer you
> are in trouble...
>
> I solved it by doing the following:
> Move '"C:\Program Files\Adobe\Acrobat
> 6.0\Reader\acrord32.exe"' To sAcrobat
> Move 'HP LaserJet 1022n' To sDriver
> If (sPrinterQueName = 'PRN-000452') Move 'IP_172.30.0.172'
> To sPort
> If (sPrinterQueName = 'PRN-000453') Move 'IP_172.30.0.173'
> To sPort
> If (sPrinterQueName = 'PRN-000454') Move 'IP_172.30.0.174'
> To sPort
> If (sPrinterQueName = 'PRN-000455') Move 'IP_172.30.0.175'
> To sPort
> If (sPrinterQueName = 'PRN-000456') Move 'IP_172.30.0.176'
> To sPort
> If (sPrinterQueName = 'PRN-000457') Move 'IP_172.30.0.177'
> To sPort
> If (sPrinterQueName = 'PRN-000458') Move 'IP_172.30.0.178'
> To sPort
> Runprogram Background sAcrobat (' /t "' - sFilename - '"
> "' - sPrinterQueName - '" "' - sDriver - '" "' - sPort - '"')
>
> I know this should have been done cleaner, but I was in a hurry
> changing it from the default printer mechanism.
>
> ps It seems that the /t option is not supported in acroread 7, so use
> 5 ot 6.
>
> Cheers,
> Marco
>
>
>
>
>
> On Tue, 6 Sep 2005 08:14:22 -0400, "britk9" <britk9@bellsouth.net>
> wrote:
>
> >Archie,
> >
> >(Sorry, I deleted the original thread)
> >
> >The following is the a VB script that a business acquaintance sent me
that
> >will print an existing PDF file to the default printer. (I tested it on
an
> >existing PDF file and it indeed does work.)
> >
> >===================
> >set shellApp=createobject("shell.application")
> >shellApp.ShellExecute "d:\temp\sample.pdf",,,"print",7
> >===================
> >
> >According to this fellow, the following can be added to the above with VB
> >script.....
> >
> >1. Open "select printer" dialog (doable from a vbs)
> >2. Set this selected printer to be the default printer (doable from vbs)
> >3. Print PDF as in above sample to the default printer
> >4. Restore the original default printer (doable from a vbs)
> >
> >===================
> >
> >I know pretty much nothing about VB so hopefully you or someone on this
NG
> >can add the above VBS and post it for all. (I'd ask my acquaintance to
do
> >this but it would be chargeable. If no one here can do the VBS, let me
know
> >and I can inquire as to the charge.)
> >
> >HTH,
> >Mike
> >
> >

Archie Campbell
12-Sep-2005, 10:58 AM
Thanks Mike and Marco
A
"Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
news:iafvh1lidm6dh0aog6ulepj4pn41h60t1k@4ax.com...
> Mike,
>
> I did exactlly that from a VDF program a couple of months ago. I found
> that this does not work relyable.
> When a batch of documents was processed, with all different printers,
> it ended all up on the first one.
> It seems like that the shell execute does not get executed
> immediately. If your program already set another default printer you
> are in trouble...
>
> I solved it by doing the following:
> Move '"C:\Program Files\Adobe\Acrobat
> 6.0\Reader\acrord32.exe"' To sAcrobat
> Move 'HP LaserJet 1022n' To sDriver
> If (sPrinterQueName = 'PRN-000452') Move 'IP_172.30.0.172'
> To sPort
> If (sPrinterQueName = 'PRN-000453') Move 'IP_172.30.0.173'
> To sPort
> If (sPrinterQueName = 'PRN-000454') Move 'IP_172.30.0.174'
> To sPort
> If (sPrinterQueName = 'PRN-000455') Move 'IP_172.30.0.175'
> To sPort
> If (sPrinterQueName = 'PRN-000456') Move 'IP_172.30.0.176'
> To sPort
> If (sPrinterQueName = 'PRN-000457') Move 'IP_172.30.0.177'
> To sPort
> If (sPrinterQueName = 'PRN-000458') Move 'IP_172.30.0.178'
> To sPort
> Runprogram Background sAcrobat (' /t "' - sFilename - '"
> "' - sPrinterQueName - '" "' - sDriver - '" "' - sPort - '"')
>
> I know this should have been done cleaner, but I was in a hurry
> changing it from the default printer mechanism.
>
> ps It seems that the /t option is not supported in acroread 7, so use
> 5 ot 6.
>
> Cheers,
> Marco
>
>
>
>
>
> On Tue, 6 Sep 2005 08:14:22 -0400, "britk9" <britk9@bellsouth.net>
> wrote:
>
> >Archie,
> >
> >(Sorry, I deleted the original thread)
> >
> >The following is the a VB script that a business acquaintance sent me
that
> >will print an existing PDF file to the default printer. (I tested it on
an
> >existing PDF file and it indeed does work.)
> >
> >===================
> >set shellApp=createobject("shell.application")
> >shellApp.ShellExecute "d:\temp\sample.pdf",,,"print",7
> >===================
> >
> >According to this fellow, the following can be added to the above with VB
> >script.....
> >
> >1. Open "select printer" dialog (doable from a vbs)
> >2. Set this selected printer to be the default printer (doable from vbs)
> >3. Print PDF as in above sample to the default printer
> >4. Restore the original default printer (doable from a vbs)
> >
> >===================
> >
> >I know pretty much nothing about VB so hopefully you or someone on this
NG
> >can add the above VBS and post it for all. (I'd ask my acquaintance to
do
> >this but it would be chargeable. If no one here can do the VBS, let me
know
> >and I can inquire as to the charge.)
> >
> >HTH,
> >Mike
> >
> >