Sub Tif2PDF(FileName As String, PdfNAme As String) Dim AcroApp As CAcroApp Dim AVDoc As CAcroAVDoc Dim PDDoc As CAcroPDDoc Dim PdfSrc As CAcroPDDoc Dim PdfDst As CAcroPDDoc Dim jso As Object Dim IsSuccess As Boolean Set AcroApp = CreateObject("AcroExch.App") Set AVDoc = CreateObject("AcroExch.AVDoc") Set PdfSrc = CreateObject("AcroExch.PDDoc") Set PdfDst = CreateObject("AcroExch.PDDoc") 'open jpg Call AVDoc.Open(FileName, "") Set AVDoc = AcroApp.GetActiveDoc If AVDoc.IsValid Then If CounterPDF = 1 Then Set PdfDst = AVDoc.GetPDDoc ' PdfDst.Save PdfNAme If PdfDst.Save(1 Or 4 Or 32, PdfNAme) <> True Then MsgBox "Failed to save " & FileName End If PdfDst.Close Else If PdfDst.InsertPages(PdfDst.GetNumPages() - 1, PdfSrc, 0, PdfSrc.GetNumPages(), True) Then Set jso = PdfDst.GetJSObject 'Save document If PdfDst.Save(1, PdfNAme) <> True Then MsgBox "Failed to save " & FileName End If End If 'Clean up Set jso = Nothing PdfDst.Close End If End If 'Close the PDF AVDoc.Close True AcroApp.Exit 'Cleanup Set PdfDst = Nothing Set PdfSrc = Nothing Set AVDoc = Nothing Set AcroApp = Nothing End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)