Solved

Print PDF Files

Posted on 2013-12-27
12
1,549 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 14

Author Comment

by:Bill Ross
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Bill,

Thanks for the update.
0
 
LVL 14

Author Comment

by:Bill Ross
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Outlook Free & Paid Tools
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

743 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

19 Experts available now in Live!

Get 1:1 Help Now