🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.acrobat.sdk
Article #33

Using VB6 to print a PDF with Acrobat 9

#33
From: McKilty
Date: Wed, 16 Sep 2009 19:51
42 lines
2499 bytes
I have an app that allows users to select multiple files and print
them regardless if they are Word, Excel, PowerPoint, or PDF files.  I
had it working on my computer, but I had Acrobat 7.  The rest of the
staff has Acrobat 9 and when the print, nothing happens.

So I installed Acrobat 9 and now nothing happens for me either.  In
VB6, the reference I use is Adobe Acrobat 9.0 Type Library.  The code
is as follows:

Public Sub AcrobatPrint(Filename As String)

 Dim AcroExchApp As Acrobat.CAcroApp
 Dim AcroExchAVDoc As Acrobat.CAcroAVDoc
 Dim AcroExchPDDoc As Acrobat.CAcroPDDoc
 Dim num As Integer

 Set AcroExchApp = CreateObject("AcroExch.App")
 Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")

 ' Open the [strfiley] pdf file
 AcroExchAVDoc.Open Filename, ""

 ' Get the PDDoc associated with the open AVDoc
 Set AcroExchPDDoc = AcroExchAVDoc.GetPDDoc

 ' Get the number of pages for this pdf [and subtract one as zero
based]
 num = AcroExchPDDoc.GetNumPages - 1
 Call AcroExchAVDoc.PrintPages(0, num, 1, True, True)

 'AcroExchApp.Show 'activate this line if you want to see the acrobat
file
 AcroExchApp.Exit
 AcroExchAVDoc.Close (True)
 AcroExchPDDoc.Close


End Sub


It opens the file and gets the page count, but the print command is
pretty much ignored.  Any ideas?
Technical Details
Message-ID: <2157b29e-a603-4f0d-8028-38c675e51644@o36g2000vbl.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!o36g2000vbl.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 2105b4c04d,dba07793549f6cb0,start
X-Google-Attributes: gid2105b4c04d,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!o36g2000vbl.googlegroups.com!not-for-mail
From: McKilty <bluesbrthr@gmail.com>
Newsgroups: adobe.acrobat.sdk
Subject: Using VB6 to print a PDF with Acrobat 9
Date: Wed, 16 Sep 2009 12:51:50 -0700 (PDT)
Organization: http://groups.google.com
Lines: 42
Message-ID: <2157b29e-a603-4f0d-8028-38c675e51644@o36g2000vbl.googlegroups.com>
NNTP-Posting-Host: 63.119.101.66
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1253130710 3632 127.0.0.1 (16 Sep 2009 19:51:50 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 16 Sep 2009 19:51:50 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: o36g2000vbl.googlegroups.com; posting-host=63.119.101.66; 
 posting-account=QGWcQgoAAADyQ45AEg9sP8lnL-TBY1aZ
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) 
 Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)