Button on view
Use "SwPDFMain"
Sub Click(Source As Button)
Dim w As New NotesUIWorkspace, s As New NotesSession, dc As NotesDocumentCollection
Dim swPDF As New SwPDFCreator, swPDFDoc As SwPDFDocument
' Get documents selection from view
Set dc = s.CurrentDatabase.UnprocessedDocuments
' Initialize PDF creation process; license key is required
If swPDF.Init("<YOUR LICENSE KEY GOES HERE>") Then
If dc.Count = 1 Then
' Convert doc to PDF
Set swPDFDoc = swPDF.ProcessDocument(dc.GetFirstDocument)
Else
' Convert document collection to PDF
Set swPDFDoc = swPDF.ProcessDocCollection(dc, w.CurrentView.ViewName)
End If
' Finally, save generated PDF to a file on disk
Call swPDFDoc.SaveToFile("c:\temp\test.pdf")
Msgbox "PDF successfully created."
Else
' There was an error in PDF initialization
Dim pdfErr As SwPDFError
Set pdfErr = swPDF.GetError()
Msgbox "An error occurred: (" & pdfErr.Code & ") " & pdfErr.Message & " - line " & pdfErr.Position
End If
End Sub
Last updated