Solved

Print PDF Files

Posted on 2013-12-27
12
1,606 Views
Last Modified: 2014-01-28
Hi,

I have about 100 PDF files that need to be printed each month.  I have an MS Access database table that lists the files.  What I would like to do is loop through the recordset and print each file without opening the file or at least automatically opening and closing the file.

Essentially, I want to print all 100 files with a single mouse click.

Any ideas?

Thanks in advance!

Bill
0
Comment
Question by:Bill Ross
  • 4
  • 4
  • 3
12 Comments
 
LVL 39

Assisted Solution

by:als315
als315 earned 250 total points
ID: 39743235
You can use Adobe Acrobat Reader for printing, but in this case you should know, where it is located. If you have static configuration, you can find exe and add path to code. For example, in Windows 7 x64 it is here:
c:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe
Use this sub in loop through all files from your table:
Sub print_pdf(FName As String)
Dim AcroPath As String
AcroPath = "c:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
Shell (AcroPath & " /p /h " & Chr(34) & FName & Chr(34))
End Sub
'Call sample
Sub test()
print_pdf ("e:\Downloads\w_makb05.pdf")
End Sub

Open in new window

File will be printed on default printer
0
 
LVL 21
ID: 39743944
I find this works best.

CreateObject("Shell.Application").Namespace(0).ParseName("c:\mypdf\myDoc.pdf").InvokeVerb ("Print")

Open in new window


You do not have to know the path the the EXE. It will use the default PDF app. I use thia with Acrbat, Nitro and some others.
0
 
LVL 14

Author Comment

by:Bill Ross
ID: 39744036
Hi als315 & HiTechCoach,

Both options work OK but Adobe opens each time, prints then leaves itself open.  Takes forever to get the reports to print 10-15 sec.

Given this, my 100 document print job will take 20 minutes which is OK but the user must watch Adobe open/close, etc. and has a lot of "Not Responding" messages.  I think the users might quit out...

I would like a "silent" method where I can just put a progress bar on the screen and no Adobe flash.  Any ideas?

Thanks,

Bill
0
 
LVL 39

Expert Comment

by:als315
ID: 39744435
I think you can't get more with Adobe Acrobat Reader. May be you can try any third party solutions. You can get one here:
http://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/
Help for command line options is included

Here is an article with how to for .net with code:
http://netchallenge.wordpress.com/2009/04/30/silent-printing-pdf-in-net-using-gsprint-and-additional-truetype-fonts/
0
 
LVL 21
ID: 39745593
If you are going to use Acrobat and want it silent then use /t not /p


AcroRd32.exe /t "C:\test.pdf" "\\servername\printername"


/t <filename> <printername> <drivername> <portname> - Print the file the specified printer.

Example:
Sub print_pdf(FName As String)

     Dim AcroPath As String

     AcroPath = "c:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"

     Shell (AcroPath & " /t " & Chr(34) & FName & Chr(34))
End Sub
'

Open in new window



You may also need to disable "Activate protected mode at startup"

  [HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\11.0\Privileged]
     "bProtectedMode"=dword:00000000

Open in new window


I generally avoid Acrobat Reader because ti loads so slow. I recommend to all my clients/users that they  use Nitro Reader.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 14

Author Comment

by:Bill Ross
ID: 39746055
Hi Tech - Suppose I have the users install Nitro reader - how do I make sure it's used if they also have Adobe Reader and maybe even Adobe Pro installed?

als - Have you tried the Ghostscript process in VBA?
0
 
LVL 39

Expert Comment

by:als315
ID: 39746119
I've not tried to print many files, but one file is printed with similar to AcroReader code:
AcroPath = "c:\Program Files\Ghostgum\gsview\gsview64.exe"
Shell (AcroPath & " -p " & Chr(34) & FName & Chr(34))

Open in new window

0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 39746408
BillDenver,

Did you try using the /t not the /p with Acrobat?

Suppose I have the users install Nitro reader - how do I make sure it's used if they also have Adobe Reader and maybe even Adobe Pro installed?

To use a specific app, not the default one, you will need to know the full path t tot he app. There are several ways to do this. Shell() is just one.  

One of the downsides using a specific app is that you need to know the full path the the exe. It is not the same for Acrobat reader and full Acrobat.. The path also varies by versions. I use a ini file on each machine to hold the settings. This allows me to configure the app on each workstation based on the software installed.
0
 
LVL 14

Author Comment

by:Bill Ross
ID: 39752715
Hi,

I am traveling this week.  I'm going to test the various solutions over the weekend to see what works best.  

Thanks!

Bill
0
 
LVL 21
ID: 39752941
Bill,

Thanks for the update.
0
 
LVL 14

Author Comment

by:Bill Ross
ID: 39767152
Hi Guys,

Sorry for the delay - I'm still on the road through next week and will test when I get back in the office.

Bill
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now