Printing an embedded PDF file

  • Thread starter Thread starter Ian Belcher
  • Start date Start date
I

Ian Belcher

Hi,
I've got some embedded pdf's in a table and I would like
to print them using some VB script. I can't find any
commands that would enable me to do this. Is this
possible?

Thanks
Ian
 
Ian:

If you've embedded these a OLE documents in your table, then there's really
no way to print the object from the table, because acrobat needs to be
launched manually by double clicking on the item and then you need to
control that app. The easier way to do it is to do either of the following:

Common to both methods is that rather than putting a PDF file in an OLE
field, all you do is to store the path to the file in a text field. Then

1.) If you want to display the PDF document, create a form and embed an
Adobe Acrobat Control for ActiveX object on the form and in the on current
event, set the .src property of that control to the file specified by the
path from your text field. Then simply add a command button on your form
(once the file is displayed) to print the file using code like this:

Dim objPDFCtrl As Object
Set objPDFCtrl = Me!PDFControlName
objPDFCtrl.printAll
Set objPDFCtrl = Nothing

2.) If you don't want to display the PDF but simply want to print it, then
you've got to launch Acrobat or Acrobat reader which ever the user has, load
the file and send a print command. This can be done using the code that I
posted in this forum on March 16, under the post name of "OutputTo a Report"
(do a google search) which shows the code to find the appropriate install of
Acroabt and display a file. Changing two lines of code in that post's
DisplayPDF will result in printing the object. Those two lines are:

strAcroPath = strAcroPath & " /p/h " & strTargetPDF
dwReturn = Shell(strAcroPath, vbMinimizedNoFocus)

HTH
 
Back
Top