Home   |   Parenting   |   Bible Corner   |   Programming   |   Links   |   Guestbook
  
Programming - TIF 2 PDF

Make sure and include the Adobe Acrobat library in your project (from the project references dialog).


Private Sub Tif2PDF(filename As String)
Dim AcroApp As CAcroApp
Dim AVDoc As CAcroAVDoc
Dim PDDoc As CAcroPDDoc
Dim IsSuccess As Boolean

    Set AcroApp = CreateObject("AcroExch.App")
    Set AVDoc = CreateObject("AcroExch.AVDoc")
        
    Call AVDoc.Open(filename, "")
    
    Set AVDoc = AcroApp.GetActiveDoc
    
    If AVDoc.IsValid Then
    
        Set PDDoc = AVDoc.GetPDDoc
		        
        ' Fill in pdf properties.
        PDDoc.SetInfo "Title", txtDocTitle.Text
        PDDoc.SetInfo "Author", txtDocAuthor.Text
        PDDoc.SetInfo "Subject", cboDocType.Text
        PDDoc.SetInfo "Keywords", txtDocKeyword.Text
                
        If PDDoc.Save(1 Or 4 Or 32, App.Path & "\pdf\docfile.pdf") <> True Then
            MsgBox "Failed to save " & filename
        End If
        
        PDDoc.Close
    
    End If
    
    'Close the PDF
    AVDoc.Close True
    AcroApp.Exit
	        
    'Cleanup
    Set PDDoc = Nothing
    Set AVDoc = Nothing
    Set AcroApp = Nothing

End Sub

Version 2, July 2000 ©Alastair Vance - Email: vance@ukonline.co.uk