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

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Viewer MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-viewer -- dnx GroupDocs.Viewer.Mcp --yes
Folders, licensing and more →

GroupDocs.Viewer for Python via .NET 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 .NET 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.for_embedded_resources method to create an HtmlViewOptions class instance and pass this instance to the Viewer.view method.

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions

def render_nsf_to_html():
    # Load NSF file
    with Viewer("sample.nsf") as viewer:
        # Create an HTML file.
        viewOptions = HtmlViewOptions.for_embedded_resources("render_nsf_to_html/pdf_page_{0}.html")
        viewer.view(viewOptions)

if __name__ == "__main__":
    render_nsf_to_html()

sample.nsf is the sample file used in this example. Click here to download it.

HTML file (275 KB)

Download full output

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.

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import PdfViewOptions

def render_nsf_to_pdf():
    # Load NSF file
    with Viewer("sample.nsf") as viewer:
        # Create a PDF file.
        viewOptions = PdfViewOptions("render_nsf_to_pdf/lotus_notes.pdf")
        viewer.view(viewOptions)

if __name__ == "__main__":
    render_nsf_to_pdf()

sample.nsf is the sample file used in this example. Click here to download it.

Binary file (PDF, 398 KB)

Download full output

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.height and PngViewOptions.width properties to specify the output image size in pixels.

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import PngViewOptions

def render_nsf_to_png():
    # Load NSF file
    with Viewer("sample.nsf") as viewer:
        # Convert the NSF file to PNG.
        # {0} is replaced with the page numbers in the output image names.
        viewOptions = PngViewOptions("render_nsf_to_png/lotus_notes_page_0_{0}.png")
        # Set width and height.
        viewOptions.width = 800
        viewOptions.height = 1000
        viewer.view(viewOptions)

if __name__ == "__main__":
    render_nsf_to_png()

sample.nsf is the sample file used in this example. Click here to download it.

render_nsf_to_png/lotus_notes_page_0_1.png (45 KB)
render_nsf_to_png/lotus_notes_page_0_2.png (109 KB)

Download full output

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.height and JpgViewOptions.width properties to specify the output image size in pixels.

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import JpgViewOptions

def render_nsf_to_jpg():
    # Load NSF file
    with Viewer("sample.nsf") as viewer:
        # Convert the NSF file to JPEG.
        # {0} is replaced with the page numbers in the output image names.
        viewOptions = JpgViewOptions("render_nsf_to_jpg/nsf_to_jpg_{0}.jpg")
        # Set width and height.
        viewOptions.width = 800
        viewOptions.height = 1000
        viewer.view(viewOptions)

if __name__ == "__main__":
    render_nsf_to_jpg()

sample.nsf is the sample file used in this example. Click here to download it.

render_nsf_to_jpg/nsf_to_jpg_1.jpg (39 KB)
render_nsf_to_jpg/nsf_to_jpg_2.jpg (86 KB)

Download full output

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 MailStorageOptions property 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 mail_storage_options.max_items property 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:

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions

def render_nsf_with_max_items():
    # Load NSF file
    with Viewer("sample.nsf") as viewer:
        # Create an HTML file.
        viewOptions = HtmlViewOptions.for_embedded_resources("render_nsf_with_max_items/nsf_with_max_items.html")
        # Specify the maximum items to render.
        viewOptions.mail_storage_options.max_items = 20
        viewer.view(viewOptions)

if __name__ == "__main__":
    render_nsf_with_max_items()

sample.nsf is the sample file used in this example. Click here to download it.

HTML file (275 KB)

Download full output

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:

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions

def render_nsf_with_filters():
    # Load NSF file
    with Viewer("sample.nsf") as viewer:
        # Create an HTML file.
        viewOptions = HtmlViewOptions.for_embedded_resources("render_nsf_with_filters/nsf_with_filters.html")
        # Set filters
        viewOptions.mail_storage_options.text_filter = "Viewer"
        viewOptions.mail_storage_options.address_filter = "groupdocs@mail.com"
        viewer.view(viewOptions)

if __name__ == "__main__":
    render_nsf_with_filters()

sample.nsf is the sample file used in this example. Click here to download it.

HTML file (32 KB)

Download full output