Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ConvertToPDF macro no longer supported in Adobe versions 5.0 - 7.0... 1

Status
Not open for further replies.

ksw1069

Programmer
May 5, 2006
7
US
I have an VB6 app that calls ConvertToPDF macro in an active Word document to convert it to PDF.

Some of my users have Adobe Acrobat version 5.0 through 7.0 where the ConvertToPDF macro is not supported.

Does anyone know the comparable macro to execute for these version of Acrobat?

Thanks!
 
had a look recently re how to do this with Acrobat 7
(OT: settled on OpenOffice/GhostScript)

try both code snippets below
cannot recall if the second one worked
the trial period for my Acrobat 7 expired last week

Code:
Option Explicit

Const DOC2PDFERR = vbObjectError + 20060529

Private Sub Command1_Click()

    Dim src As String
    Dim dst As String
    
    src = "I:\Source\python\Elsevier\query2pdf\art51113.doc"
    dst = "I:\Source\python\Elsevier\query2pdf\art51113.pdf"
    Call doc2pdf(src, dst)
    MsgBox Dir$(dst)
    Unload Me
End Sub

Private Sub doc2pdf(src As String, dst As String)
    Const NOSAVE = -1
    Const PDSaveFull = 1
    
    Dim o As Object ' AcroPDDoc
    Dim a As Object ' AcroAVDoc
    
    Set a = CreateObject("AcroExch.AVDoc") ' New AcroAVDoc
    If Not a.Open(src, "doc2pdf") Then
        Err.Raise DOC2PDFERR, , "unable to open " & src
    End If
    Set o = a.GetPDDoc()
    
    If Not o.Save(PDSaveFull, dst) Then
        Err.Raise DOC2PDFERR, , "unable to save " & dst
    End If
    
    If Not o.Close() Then
        Err.Raise DOC2PDFERR, , "unable to close " & dst
    End If
    Set o = Nothing
    If Not a.Close(NOSAVE) Then
        Err.Raise DOC2PDFERR, , "unable to close " & src
    End If
    Set a = Nothing
End Sub

Code:
Option Explicit

Private Sub Command1_Click()
    Dim obj As PDFMAKERAPILib.PDFMakerApp
    Dim docpth As String
    Dim pdfpth As String
    
    docpth = "I:\Source\python\Elsevier\query2pdf\test.doc"
    pdfpth = "I:\Source\python\Elsevier\query2pdf\vb.pdf"
    
'    Set obj = CreateObject("PDFMAKERAPILib.PDFMakerApp")
    Set obj = New PDFMAKERAPILib.PDFMakerApp
    With obj
        Call .CreatePDF(docpth, pdfpth)
'        Call .CreatePDF(docpth, pdfpth, bConvertSilent:=True, _
'            bShowProgress:=False, bConvertAsync:=False)
    End With
    Set obj = Nothing
    MsgBox Dir(pdfpth)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top