PDF only Prints first Page when using VBA to print from Acrobat 5

C

Chuck Reed

I have a MS Access data base that creates custom reports for clients
in PDF form then prints the reports after all client's reports have
been printed. The problem that I have run into is that when acrobat is
printing to my printer, I can get it to print only the first page of a
report(OPTION 1 BELOW) or it is spooled to the printer then deleted in
the print cue before it it printed (OPTION 2 BELOW).

It's been very frustrating trying to get these reports to print and
I've logged over 20 hours reading posts to see if anyone else was
having a similar problem. I'm using Acrobat 5 and an HP office jet
7130 printer. I have tried the DDE option of printing but it too has
some quirks that just are not acceptable.

Any help would be appreciated!

Chuck Reed
(e-mail address removed)

Option Explicit
Dim AcrDoc As CAcroAVDoc,AcrApp as CAcroApp,AcroPDDoc As CAcroPDDoc
Sub testprintpdf()
OpenAcrobat
PrintPDFDoc "G:\Weekly Reports\ReportTemp\2\1Daily.pdf"
CloseAcrobat
End Sub

Private Sub OpenAcrobat()
Set AcrApp = CreateObject("AcroExch.App")
AcrApp.Maximize 1
DoEvents
End Sub

Private Sub PrintPDFDoc(x As String)
Dim AcrDoc As CAcroAVDoc, lngPages As Long

Set AcrDoc = CreateObject("AcroExch.AVDoc")
AcrDoc.Open x, "PDF Print"
DoEvents
Set AcroPDDoc = AcrDoc.GetPDDoc
lngPages = AcroPDDoc.GetNumPages
'OPTION 1
AcrDoc.PrintPages 0, lngPages, 1, True, True 'HERE THE PRINT QUE
DELETES AFTER SPOOLING IF I USE THIS COMMAND AND TELL IT HOW MANY
PAGES I'M PRINTING.
'OPTION 2
AcrDoc.PrintPages 0, 0, 1, True, True 'ONLY PRINTS FIRST PAGE WITH
THIS OPTION.
DoEvents
AcrDoc.Close True
DoEvents
Set AcrDoc = Nothing
DoEvents
End Sub

Private Sub CloseAcrobat()
AcrApp.CloseAllDocs
AcrApp.Exit
Set AcrApp = Nothing
DoEvents
End Sub
 
R

Ron Weiner

Chuck

What happens when you try

AcrDoc.PrintPages 0, lngPages - 1, 1, True, True

Ron W
 
C

Chuck Reed

Ron Weiner said:
Chuck

What happens when you try

AcrDoc.PrintPages 0, lngPages - 1, 1, True, True

Ron W
Ron,

This worked well. I've not found any documentation that discusses that
you have to reduce the page count by one. Thank you!
 
A

Aandi Inston

This worked well. I've not found any documentation that discusses that
you have to reduce the page count by one. Thank you!

The current IAC Reference says:

....
nFirstPage The first page to print. The first page in a PDDoc is
page 0.
nLastPage The last page to print. The first page in a PDDoc is page
0.

Perhaps not completely explicit but a clue.

(Anyone planning Acrobat development should consider the Acrobat SDK a
must. http://partners.adobe.com/asn/acrobat/docs.jsp. Only limited
documents are free).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top