Render Lotus Notes database files as HTML, PDF, and image files

GroupDocs.Viewer for Node.js via Java allows you to render Lotus Notes Storage Facility (NSF) files in HTML, PDF, PNG, and JPEG formats. Use this library to display the contents of NSF files within your Node.js application (web or desktop).

To start with the GroupDocs.Viewer API, create a Viewer class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the Viewer.view method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages.

View NSF files online View demos and examples on GitHub

Render Lotus Notes database files as HTML

To convert an NSF file to HTML, call the HtmlViewOptions.forEmbeddedResources method to create an HtmlViewOptions class instance and pass this instance to the Viewer.view method.

const viewer = new groupdocs.viewer.Viewer("sample.nsf")
// Specify the HTML file name.
const viewOptions = groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("output.html")
viewer.view(viewOptions)

The following image demonstrates the result:

Render an NSF file to HTML

Render Lotus Notes database files as PDF

Create a PdfViewOptions class instance and pass it to the Viewer.view method to convert an NSF file to PDF. The PdfViewOptions class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: Rendering to PDF.

const viewer = new groupdocs.viewer.Viewer("sample.nsf")
// Create a PDF file.
const viewOptions = groupdocs.viewer.PdfViewOptions("output.pdf")
viewer.view(viewOptions)

The following image demonstrates the result:

Render an NSF file to PDF

Render Lotus Notes database files as PNG

Create a PngViewOptions class instance and pass it to the Viewer.view method to convert an NSF file to PNG. Use the PngViewOptions.setHeight and PngViewOptions.setWidth methods to specify the output image size in pixels.

const viewer = new groupdocs.viewer.Viewer("sample.nsf")
// Convert the NSF file to PNG.
// {0} is replaced with the page numbers in the output image names.
const viewOptions = groupdocs.viewer.PngViewOptions("output_{0}.png")
// Set width and height.
viewOptions.setWidth(950)
viewOptions.setHeight(550)
viewer.view(viewOptions)

The following image demonstrates the result:

Render an NSF file to PNG

Render Lotus Notes database files as JPEG

Create a JpgViewOptions class instance and pass it to the Viewer.view method to convert an NSF file to JPEG. Use the JpgViewOptions.setHeight and JpgViewOptions.setWidth methods to specify the output image size in pixels.

const viewer = new groupdocs.viewer.Viewer("sample.nsf")
// Convert the NSF file to JPG.
// {0} is replaced with the page numbers in the output image names.
const viewOptions = groupdocs.viewer.JpgViewOptions("output_{0}.jpg")
// Set width and height.
viewOptions.setWidth(950)
viewOptions.setHeight(550)
viewer.view(viewOptions)

Specify rendering options

GroupDocs.Viewer supports the MailStorageOptions class that allows you to specify different options for rendering Lotus Notes database files. To access these options, use the setMailStorageOptions method for one of the following classes (depending on the output file format):

Limit the number of items to render

When you load large Lotus Notes database files, it may take a significant amount of time to retrieve and render file contents. To improve rendering performance, use the MailStorageOptions.setMaxItems method to limit the number of rendered items. The default property value is 0 (all existing items appear in the output file).

The following example demonstrates how to specify the maximum number of items to render:

const viewer = new groupdocs.viewer.Viewer("sample.nsf")
// Create an HTML file.
const viewOptions = groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("output.html")
// Specify the maximum items to render.
viewOptions.getMailStorageOptions().setMaxItems(20)
viewer.view(viewOptions)

Filter messages

IBM Notes allows you to filter messages by specific words in the message body or by part of the sender’s or recipient’s address.

Filter messages in IBM Notes

With GroupDocs.Viewer, you can also filter messages before rendering a Lotus Notes database file to HTML, PDF, or image format. To do this, use the following properties:

The following code sample filters messages in an NSF file before rendering this file to HTML:

const viewer = new groupdocs.viewer.Viewer("sample.nsf")
// Create an HTML file.
const viewOptions = groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("output.html")
 // Set filters.
viewOptions.setTextFilter("April 2015");
viewOptions.setAddressFilter("test@test.com");
viewer.view(viewOptions)