I need to generate pdfs from lotus notes documents and store it in shared folder. I have downloaded pdfcreator2.1.2 and I’m getting error ‘INITIALIZE cannot create automation object’ at line ‘Set PDFCreator = CreateObject(“PDFCreator.clsPDFCreator”)’ … quick help on this will be really appreciate. If there is any other way, please mail me at t.raviachari@gmail.com. Thank you----------------
On Error GoTo ErrorHandler
Dim docSelected As NotesDocument
Dim uiWS As NotesUIWorkspace
Dim uiDocCurrent As NotesUIDocument
Dim sPDFPath As String
Dim PDFCreator As Variant
Set uiWS = New NotesUIWorkspace
Set docSelected = doc
Set uiDocCurrent = uiWS.Editdocument(False, docSelected)
Dim rti As NotesRichTextItem
Set rti = docSelected.GetFirstItem(“Body”)
Dim rtnav As NotesRichTextNavigator
Set rtnav = rti.CreateNavigator
If rtnav.FindFirstElement(RTELEM_TYPE_SECTION) Then
Call uiDocCurrent.Expandallsections()
End If
Set PDFCreator = CreateObject(“PDFCreator.clsPDFCreator”)
If Not PDFCreator.cStart(“”,True) Then
MsgBox “PDFCreator printer is not installed”,16,“PDFCreator”
Exit Sub
End If
sPDFPath = CStr(strTargetFolder) & ""
With PDFCreator
.cOption(“UseAutosave”) = 1
.cOption(“UseAutosaveDirectory”) = 1
.cOption(“AutosaveDirectory”) = sPDFPath
.cOption(“AutosaveFilename”) = “Test.pdf”
.cOption(“AutosaveFormat”) = 0
.cOption(“OptionsVisible”) = 0
.cOption(“PDFOptimize”) = 1
.cClearCache
End With
Call uiDocCurrent.Print(1,“PDFCreator”)
Call uiDocCurrent.Close(True)
PDFCreator.cClose
Set PDFCreator = Nothing
Exit Sub
ErrorHandler:
If Not PDFCreator Is Nothing Then
PDFCreator.cClose
Set PDFCreator = Nothing
End If
MsgBox "Error at line # " & Erl & " - " & Error & Chr(13) & “In ExportToPDF”
Exit Sub