1 Reply Latest reply on Sep 11, 2008 8:08 PM by (Aandi_Inston)

    How do I pass the number of print copies to AcroExch.AVDoc

      Hi,

      I have the following function to print a pdf file, but I don't seem to be able to specify the number of copies I want to print, please help! How to set the number of copies to print, thanks a lot!

      Sub PrintPDF(ByVal pdfFilePath As String, ByVal numCopyToPrint As Integer)
      'AcroPDF1.Application
      Call GetCommandBarNames
      Dim myAcroApp As AcroApp
      Dim myAVDoc As AcroAVDoc
      Dim PDDoc As AcroPDDoc
      Dim numPages As Integer
      Dim IsSuccess As Boolean

      Set myAcroApp = CreateObject("AcroExch.App")
      Set myAVDoc = CreateObject("AcroExch.AVDoc")

      myAVDoc.Open pdfFilePath, ""

      Set PDDoc = myAVDoc.GetPDDoc
      numPages = PDDoc.GetNumPages

      myAcroApp.Show
      'MsgBox "numpages = " & numPages & ", numcopies = " & numCopyToPrint
      'myAVDoc.PrintPages 1, numPages, numCopyToPrint, True, True
      myAVDoc.PrintPages 1, numPages, 2, True, True

      'Close the PDF
      myAVDoc.Close True
      myAcroApp.Hide
      myAcroApp.CloseAllDocs
      myAcroApp.Exit

      'Cleanup
      Set PDDoc = Nothing
      Set myAVDoc = Nothing
      Set myAcroApp = Nothing

      End Sub