Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Print PDF Files

Posted on 2013-12-27
12
Medium Priority
?
1,948 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
12 Comments
 
LVL 40

Assisted Solution

by:als315
als315 earned 1000 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 40

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
 
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 40

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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

722 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