Variables

Start page  Previous page  Next page

 

Besides the basic principle of 2pdf, whereby PDF files are assembled from individual Notes documents, Rich Text fields or plain texts (i.e. variable contents), you can also define wildcards in these elements (main text, header and footer). These wildcard characters, also called variables in n2pdf, are uniquely formatted and can be assigned (replaced by) other Rich Text or text content. These defined variables will be inputted into the PDF document when N2PDFProcess or N2PDFSearchAndReplace is activated.

 

Three steps must be taken to use variables:

Variable definition in the PDF using a format syntax

Filling the variables with RichText or text content

Inserting variables into the PDF file

 

Defining the variables

A variable is composed of any given name and brackets (see delimiters under "System Settings ") with the characters "[" and "]". n2pdf recognizes a text formatted in this manner as a variable that can be replaced by a different RichText or text content. You have the choice of writing such a variable directly in a Notes RichText field and then transferring it to the PDF using N2PDFAddRTContent or you can configure such a variable in a plain text and then add it to the PDF using N2PDFAddContent.

 

112

You may not use any names for variables that are already assigned to constants.

 

Example for a variable in a RichText field

Dear [Salutation],

n2pdf has received a considerable increase in functionality: The table of contents …

 

Example for a variable in a plain text (constructed directly in LotusScript):

Dim Salutation As String

Salutation = "Dear [Salutation]," + Chr$(13)+_

"n2pdf has received a considerable increase ..."

Call N2PDFAddContent ( JobID, N2PDFVALUE_CONTENT_BODY, 0, Salutation )

 

Assigning Data to Variables

n2pdf recognizes two commands for assigning the related value to the defined variable: Either N2PDFAddVariable to specify the content as plain text or N2PDFAddRTVariable for filling up the variable with a Notes RichText field. The name of the variable (without brackets) and its content are specified when these functions are activated. With N2PDFAddVariable you directly add the content for the variable, whereas with N2PDFAddRTVariable you reference a Notes document, which n2pdf then exports and uses as variable content.

 

Extension of the example above:

Salutation = "Dear [Salutation]," + Chr$(13)+_

"n2pdf has received a considerable increase ..."

Call N2PDFAddContent ( JobID, N2PDFVALUE_CONTENT_BODY, 0, Salutation )

Call N2PDFAddVariable ( JobID, 0, "Salutation", "Mr. John Doe" )

… Or …

 

Call N2PDFAddRTVariable ( JobID, 0, "Salutation", db.Server,_

db.FilePath, docVar.UniversalID, "NotesDocField" )

 

Inputting the Variables

And finally, all the variables' content must be inserted in place of the wildcards in the text. n2pdf does this automatically when the N2PDFProcess function is activated (or by directly calling N2PDFSearchAndReplace).