473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
3 10536
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JayB | last post by:
http://www.fape.org/idea/what_idea_is/discipline_overview1.htm When I try to print this page in IE, each word is on it's own line. When I try to print in Firefox, it only prints out one page. ...
1
by: Martin | last post by:
Hi, I have an ASP page, whisch generates dynamic report for a SQL server DB. Now the users want to have the content in PDF format (not HTML page). The server machine had "adobe acrobat destiller"...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
0
by: John Mac | last post by:
I have a program that encapsulates the IE browser via the AxSHDocVw.AxWebBrowser technique. All works fine. It seems to me there should be a way to locate and wire up to an ActiveX/COM...
9
by: jcvoon | last post by:
Hi: The following code work on win form application Dim faxServer As FAXCOMLib.FaxServer Dim faxDoc As FAXCOMLib.FaxDoc faxServer = New FAXCOMLib.FaxServerClass...
0
by: janakiraman | last post by:
Hi I have a page in .net. It displays the details in a grid. I have a button to print the details. when the user clicks the print button, a pop up comes up with only the details to be printed....
6
by: Filips Benoit | last post by:
Dear All, All 3 codes, copied from internet, triggers error 429 : ActiveX component can't create object ! No compile error. I have the reference set to Adobe Acrobat 7.0 Type Library I do not...
0
by: GiftX | last post by:
Hellow everyone, I am calling/manipulating Excel spreadsheet through VB 6.0. Most of my objectives are accomplished except some cosmetics. Problem#1: For example, after running my program to...
1
by: Tim Sprout | last post by:
I want to call Page Setup to set default printer and page size and orientation before batch printing pdf's silently from WebBrowser controls. I can print silently using DDE (the NDde library) or...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.