Declare Function DoPDF Lib "DOMINOPDF.DLL" (Byval szInput As String, Byval szOutput As String, Byval szOptions As String) As Long
Sub Initialize
Dim oSession As New NotesSession
Dim oDB As NotesDatabase
Dim oView As NotesView
Dim oDoc As NotesDocument
Dim sURL As String, sPDF As String, sOptions As String, sHost As String
Set oDB = oSession.CurrentDatabase
Dim ServerName As New NotesName(oDB.Server)
If oSession.IsOnServer Then
sHost = "http://" & ServerName.Common & "/"
Else
sHost = "http://localhost/"
End If
Set oView = oDB.GetView("($All)")
Set oDoc = oView.GetFirstDocument
While Not oDoc Is Nothing
If oDoc.Form(0) = "Memo" Then
sURL = sHost & oDB.FileName & "/" & oView.Name & "/" & oDoc.UniversalID & "?OpenDocument"
sPDF = oDoc.UniversalID & ".pdf"
sOptions = "LeftMargin=10;TopMargin=10;PageSize=A4"
Call DoPDF(sURL, sPDF, sOptions)
End If
Set oDoc = oView.GetNextDocument( oDoc )
Wend
End Sub