473,385 Members | 1,848 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,385 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 10543
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.