Ask a Question related to Adobe Acrobat SDK, Design and Development.
-
JH #1
Print PDFs form within Access using VBA
Folks,
I am trying to print out pdfs from within an Access VBA program. At the moment I simply pass a command line and call reader using:
strCommand = """" & AcrobatLocation & """ /h /t """ & PdfFileName & """ """ & PrinterName & """"
lngProID = Shell(strCommand, vbHidden)
which works up to a point.
The problems are, a) it is very slow b) I can't trap errors - for example if the pdf is a non-printable document the program just sits and waits and c) I have to close Acrobat Reader by using the sendkeys function to send a"F4" - it works but if someone opens a different window the sendkeys closes that one instead.
So what I want to do is create an Acrobat object with VBA and then use that to print out a file. I looked at the Adobe web site and copied some code from there just to try it out and get a "Active X cant create the object" error message.
For example if I have the following code in VBA, with the Acrobat 7.0 Type Library reference
public Sub Test()
Dim gApp As Acrobat.CAcroApp
Dim gPDDoc As Acrobat.CAcroPDDoc
Dim jso As Object
gApp = CreateObject("AcroExch.App")
gPDDoc = CreateObject("AcroExch.PDDoc")
If gPDDoc.Open("c:\adobe.pdf") Then
jso = gPDDoc.GetJSObject
jso.console.Show
jso.console.Clear
jso.console.println ("Hello, Acrobat!")
gApp.Show
End If
end sub
then it fails at the first CreateObject line with the error "ActiveX cant create object"
I have posted on the access forum but not got an answer to this specific problem - any help would be greatly appreciated.
John
JH Guest
-
Creating PDFs from Freehand -- print to PDFvs. export vs. print/scan to PDF?
I've had a lot of compatibility problems with created presentations so have started using Acrobat instead of trying to export my Macromedia Freehand... -
PDFs print fit to page problem
I create forms for an insurance company and our point size is required by law to be a certain point size. When pdf of the form is posted to our... -
Print-ready PDFs
We have an app that takes a static JPG and, using z-indexed divs, overlays user specific information. The HTML is made into a PDF using the CF7... -
PDFs will not print to Epson Stylus Photo 890?
I'm running OSX Panther and Acrobat 6.0.3 Professional. Every time I send a PDF to print on my Epson 890 the printer locks up and will not print. The... -
Can print, but can't view some pdfs
I just had to reinstall Acrobat 6.0 Professional (including the 6.0.1 upgrade). There are some, but not all, pdf files that now appear entirely dark...



Reply With Quote

