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

Published by

lekkim

Positive, competent, out-spoken, frank and customer focused architect and developer with a strong foundation in web, cloud and product development. I'm a strong advocate for API first and cloud based solutions and development. I have a knack for being able to communicate and present technically complicated matters in conference, customer and training settings. I've previously acted as team member and leader in a product organisation.

2 thoughts on “Print from Adobe Acrobat using OLE”

Comments are closed.