Solved

Print PDF Files

Posted on 2013-12-27
12
1,717 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 40

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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
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.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

808 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