View to PDF package

Provided code sample collects all View documents in empty NotesDocumentCollection and convert's them to PDF:

 Dim s As New NotesSession
 Dim db As NotesDatabase
 Dim view As NotesView
 Dim dc As NotesDocumentCollection
 Dim doc As NotesDocument
 Dim swPDF As SwPDFCreator
 dim swPDFDoc As SwPDFDocument

 On Error GoTo Ooops
 
 Set db = s.CurrentDatabase
 ' Set the Notes view name here
 Set view = db.Getview("<YOUR VIEW>")
 
 Set swPDF = New SwPDFCreator()
 swPDF.Init("<PDF Converter License key>") 
 swPDF.PDFSettings.useLowLevelRenderer = True

 'Let's create empty notes document collection and fill it with all view documents (THIS WILL WORK ON Lotus Notes 8+)
 Set dc = db.CreateDocumentCollection
 Set doc = view.Getfirstdocument()
 
 While Not doc Is Nothing
 call dc.Adddocument(doc)
 Set doc = view.Getnextdocument(doc)
 Wend
 '-------------------------------------------------------------------------------
 
 'Init view conversion
 Set swPDFDoc = swPDF.ProcessDocCollection(dc, "<YOUR VIEW>")

 MsgBox "Doc processed"
 Call swPDFDoc.SaveToFile("C:\temp\Test.pdf")

 Exit function

Ooops:
 MsgBox "Error Code:" & CStr(Err()) & " on line " & Erl & " Description: " & Error
 Exit function

Last updated