By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
vb*@cox-internet.com

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
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Chuck

What happens when you try

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

Ron W

"Chuck Reed" <vb*@cox-internet.com> wrote in message
news:26**************************@posting.google.c om...
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
vb*@cox-internet.com

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

Nov 13 '05 #2

P: n/a
"Ron Weiner" <we*********@mindspring.com> wrote in message news:<uH**************@TK2MSFTNGP12.phx.gbl>...
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!
Nov 13 '05 #3

P: n/a
vb*@cox-internet.com (Chuck Reed) wrote:

AcrDoc.PrintPages 0, lngPages - 1, 1, True, True
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).

----------------------------------------
Aandi Inston qu***@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.