Print from Adobe Acrobat using OLE

Just to have it somewhere… The code is from Visual Basic 6 with reference to the Acrobat TLD.

Private Sub Command1_Click()
    Dim doc As New AcroAVDoc
    If doc.Open("c:test.pdf", "PDF Print") Then
        Dim numPages As Long
        numPages = doc.GetPDDoc().GetNumPages
        Debug.Print "Document has " & numPages & " page(s)..."
        If doc.PrintPagesSilent(0, numPages - 1, 0, True, True) Then
            Debug.Print "Printed document..."
        End If
    Else
        MsgBox "failed to open document"
    End If

    If Not (doc Is Nothing) Then
        Call doc.Close(True)
    End If
End Sub

2 thoughts on “Print from Adobe Acrobat using OLE”

Comments are closed.