|
How To Convert Selected Documents In Notes To PDF |
|
Selected documents in a Notes view can easily be converted to PDF. Instructions for creating an agent together with sample code are provided in this tutorial.
In the Lotus Domino Designer create a new agent and set the runtime settings for processing selected documents.
The agent can then process a Notes Document Collection for the selected documents and call DominoPDF to convert each in turn to PDF.
The source code for the agent demonstrated in this tutorial can be downloaded here.
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 oCollection As NotesDocumentCollection
Dim oDoc As NotesDocument
Dim sInput As String, sOutput As String, sOptions As String
On Error Goto Error_Handler
Set oDB = oSession.CurrentDatabase
sOptions = "Database=" & oDB.FileName & ";"
sOptions = sOptions & "LeftMargin=10;"
sOptions = sOptions & "RightMargin=10;"
sOptions = sOptions & "TopMargin=10;"
sOptions = sOptions & "BottomMargin=30;"
sOptions = sOptions & "PageSize=Letter;"
sOptions = sOptions & "Orientation=Portrait;"
sOptions = sOptions & "HTMLHeader=<center><strong>" & oDB.Title & "</strong></center><br/>;"
sOptions = sOptions & "HTMLFooter=<center>Page {$PAGE} of {$PAGECOUNT}</center><br/>;"
sOptions = sOptions & "ForceSectionExpand=True;"
sOptions = sOptions & "ForceOutlineExpand=True;"
sOptions = sOptions & "RowAtATimeTableAlt=True;"
sOptions = sOptions & "AutoLaunch=True;"
Set oCollection = oDB.UnprocessedDocuments
If oCollection.Count > 0 Then
Set oDoc = oCollection.GetFirstDocument
While Not oDoc Is Nothing
sInput = |Select @Text(@DocumentUniqueID) = "| & oDoc.UniversalID & |"|
sOutput = oDoc.UniversalID & ".pdf"
Call DoPDF(sInput, sOutput, sOptions)
Set oDoc = oCollection.GetNextDocument( oDoc )
Wend
End If
The_End:
Exit Sub
Error_Handler:
Print Error$
Resume The_End
End Sub |