Technical Core Principle

This document describes the basic technical principle of n2pdf Client and n2pdf Server Agent. Both variants are based on integration through programming. The technical principle of n2pdf Archive, by contrast, is based on the configuration of Notes documents and works without programming.

For n2pdf Client and n2pdf Server Agent, there is a basic structure that is followed for every PDF generation process. It applies to both LotusScript and Java integration. In the original text, numbered brackets are used to connect the steps with the associated LotusScript example.

Process in Practice

After initializing the n2pdf environment, the next step is to apply all settings through N2PDFSetOption and N2PDFSetGlobalOption. These can include security settings, automatically launching a viewer, or defining a table of contents. Because some options have a direct impact on the contents of the PDF file, all settings should be in place before the first item of content is added, for example with N2PDFAddContent.

After that, Notes content is found and collected, typically through a document collection or a view, before the content is passed to the job iteratively. Finally, the output path is defined and the PDF is generated with N2PDFProcess.

LotusScript Example (Excerpt)

%INCLUDE "N2PDFDEF.SCR"

Sub CreatePDF
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim JobID As Long
Dim PDFFilesName As String

Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments

JobID = N2PDFInit(0)

If (JobID >= 0) Then
Call N2PDFSetOption(JobID, N2PDFOPTION_SYSTEM_LAUNCH_VIEWER, "1", "")

While (Not (doc Is Nothing))
Call N2PDFAddRTContent(JobID, _
N2PDFVALUE_CONTENT_BODY, _
N2PDFVALUE_PAGEBREAK_AFTER, _
db.Server, _
db.FilePath, _
doc.UniversalID, _
"Lettercontent")
Set doc = collection.GetNextDocument(doc)
Wend

PDFFilesName = "C:\Temp\MyPdf.PDF"
Call N2PDFProcess(JobID, PDFFilesName, 0)
End If
End Sub