PDF from Lotus Notes Client: On-Demand DominoPDF Installation

If you're using DominoPDF in a client-side approach it may not always be possible to install the DominoPDF DLL's on each machine.

To resolve this we can attach the DominoPDF DLL's into the appropriate Notes Database / Replica and use LotusScript to 1) check if the DominoPDF DLL's exist and 2) detach the DLL's from the database if they're not found.

The sample LotusScript code below demonstrates a straightforward method for achieving the above requirement.

Note, in this sample we assume the DominoPDF DLL's have been attached to a Notes profile document. In reality any Notes document, container, etc. can be used as a storage mechanism.

Sub Initialize()
 'Declare variables
 Dim oSession As New NotesSession
 Dim oDB As NotesDatabase
 Dim oDoc As NotesDocument
 Dim oAttach As NotesEmbeddedObject  
 Dim sDir As String
 'Set variables
 Set oDB = oSession.Currentdatabase
 Set oDoc = oDB.GetProfileDocument("DominoPDF")
 'Get Notes/Domino Software Directory
 sDir = oSession.Getenvironmentstring("NotesProgram", True)
 'See if DominoPDF.DLL exists
 If Dir$(sDir & "DominoPDF.DLL", 0) = "" Then
  'File not found - detach files
  ForAll i In oDoc.Items
   If i.Type = Attachment Then
    Set oAttach = oDoc.GetAttachment(i.Values(0))
    Call oAttach.ExtractFile(sDir & oAttach.Name)  
   End If
  End ForAll  
 End If
End Sub