N2PDFAddAttachment

Start page  Previous page  Next page

 

N2PDFAddAttachment ( <JobID>, <ContentType>, <ContentOption>, <ServerName>, <DatabaseName>, <UNID>, <ItemName>, <AttachmentName> ) -> <ErrorCode>

 

Description

With this function you can import, convert, embed or as an external link add attachments from a Notes document to a PDF file. The function N2PDFSetOption with the N2PDFOPTION_ATTACHMENT_MODE is used to define how the attachment is to be handled.

 

 

The parameters <ItemName> and <AttachmentName> (see description below) decide which attachments, and which fields of the document these are taken from.

 

112

A list of the supported formats and which mode is available for each file format can be found in the documents "supported formats" and "attachments general".

 

 

Declaration for LotusScript

Declare Function N2PDFAddAttachment Lib LibName ( ByVal JobID As Long,_

ByVal ContentType As Long, ByVal ContentOption As Long,_

ByVal ServerName As Unicode String, ByVal DatabaseName As Unicode String,_

ByVal UNID As Unicode String, ByVal ItemName As Unicode String,_

ByVal AttachmentName As Unicode String ) As Long

 

Parameters

<JobID> (LONG)

The number that is returned when N2PDFInit is invoked and which references the PDF file in the memory. You use this ID to control which PDF you want to access with the function.

 

<ContentType> (LONG)

The parameter has no more meaning since the N2PDFVALUE_ATTACHMENT_CONVERT_MODE option now clearly defines the used mode. Always set the parameter to 0.

 

<ContentOption> (LONG)

This parameter only has any meaning if you have set the import mode for processing file attachments (N2PDFVALUE_ATTACHMENT_IMPORT_MODE). In this case, it is possible to add a page- or line break before or after the content of the attachment. The usage of more than one parameter at the same time is done by adding the individual values. A list of possible values is shown in the table below:

                 

<ContentOption>

Description

N2PDFVALUE_PAGEBREAK_AFTER

Adds a page break after the content.

N2PDFVALUE_PAGEBREAK_BEFORE

Adds a page break before the content.

N2PDFVALUE_CRLF_AFTER

Adds a line break after the content.

N2PDFVALUE_CRLF_BEFORE

Adds a line break before the content.

                 

ServerName> (UNICODE STRING)

This is the server name, where the database may be found, that contains the rich text field with the attachment. If this is a local database (from the perspective of the client or the server), then please enter "" as the value.

 

<DatabaseName> (UNICODE STRING)

This is the database name, that contains the rich text field with the attachment. Please keep in mind that under certain circumstances this name must also include a path if the database is found in a subdirectory of the Notes data directory. The path, however, must not be an absolute path ("C:\Notes\Data\N2PDF\Test.nsf") but always only be described as a path relative to the data directory of the client or the server ("N2PDF\Test.nsf").

 

<UNID> (UNICODE STRING)

This is the "Universal Document ID" of the rich text field.

 

<ItemName> (UNICODE STRING)

This is the name of the rich text field with the attachment that is to be added to the PDF file. If all attachments of a document are to be converted, no matter which field the attachment is saved in, then pass "" here.

 

<AttachmentName> (UNICODE STRING)

If you wish to pass a certain attachment from the document, then place the attachments name here (e.g. "Bullshark.jpg"). If you pass "" as a value, then all attachments are used that can be found in the field <ItemName>. If you want to pass more than one attachment, separate the different names with a semicolon (e.g. "Bullshark.jpg;shark.jpg").

 

112

If you give <ItemName> and <AttachmentName>, only attachments that are defined in <AttachmentName> and are also in the field <ItemName> are included.

 

Return

<ErrorCode> (LONG)

The code number of the error that has occurred when performing the function (see "Error Codes ").

 

 

Example: All attachments from the field "File" are amended as content

Call N2PDFAddAttachment ( JobID,_

0,_

N2PDFVALUE_CRLF_BEFORE,_

db.Server,_

db.FilePath,_

doc.UniversalID,_

"File",_

"" )        

 

Example: Only the attachment "Bullshark.jpg" from the field "File" is added as content

Call N2PDFAddAttachment ( JobID,_

0,_

N2PDFVALUE_CRLF_BEFORE,_

db.Server,_

db.FilePath,_

doc.UniversalID,_

"File",_

"Bullshark.jpg" )        

 

Example: All attachments from the field "File" are amended to the end of the PDF file

Call N2PDFAddAttachment ( JobID,_

0,_

N2PDFVALUE_CRLF_BEFORE,_

db.Server,_

db.FilePath,_

doc.UniversalID,_

"File",_

"" )