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.
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.nsf")){// Create an HTML file.varviewOptions=HtmlViewOptions.ForEmbeddedResources("output.html");viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.nsf")' Create an HTML file.
DimviewOptions=HtmlViewOptions.ForEmbeddedResources("output.html")viewer.View(viewOptions)EndUsingEndSubEndModule
The following image demonstrates the result:
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.
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.nsf")){// Create a PDF file.varviewOptions=newPdfViewOptions("output.pdf");viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.nsf")' Create a PDF file.
DimviewOptions=NewPdfViewOptions("output.pdf")viewer.View(viewOptions)EndUsingEndSubEndModule
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.nsf")){// Convert the NSF file to PNG.// {0} is replaced with the page numbers in the output image names.varviewOptions=newPngViewOptions("output_{0}.png");// Set width and height.viewOptions.Width=800;viewOptions.Height=1000;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.nsf")' Convert the NSF file to PNG.
' {0} is replaced with the page numbers in the output image names.
DimviewOptions=NewPngViewOptions("output_{0}.png")' Set width and height.
viewOptions.Width=800viewOptions.Height=1000viewer.View(viewOptions)EndUsingEndSubEndModule
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.nsf")){// Convert the NSF file to JPEG.// {0} is replaced with the page numbers in the output image names.varviewOptions=newJpgViewOptions("output_{0}.jpg");// Set width and height.viewOptions.Width=800;viewOptions.Height=1000;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.nsf")' Convert the NSF file to JPEG.
' {0} is replaced with the page numbers in the output image names.
DimviewOptions=NewJpgViewOptions("output_{0}.jpg")' Set width and height.
viewOptions.Width=800viewOptions.Height=1000viewer.View(viewOptions)EndUsingEndSubEndModule
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):
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.MaxItems 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:
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.nsf")){// Create an HTML file.varviewOptions=HtmlViewOptions.ForEmbeddedResources();// Specify the maximum items to render.viewOptions.MailStorageOptions.MaxItems=20;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.nsf")' Create an HTML file.
DimviewOptions=HtmlViewOptions.ForEmbeddedResources()' Specify the maximum items to render.
viewOptions.MailStorageOptions.MaxItems=20viewer.View(viewOptions)EndUsingEndSubEndModule
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.
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:
MailStorageOptions.AddressFilter—Allows you to render all messages that contain specific text in the sender’s or recipient’s address.
The following code sample filters messages in an NSF file before rendering this file to HTML:
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.nsf")){// Create an HTML file.varviewOptions=HtmlViewOptions.ForEmbeddedResources();// Set filters.viewOptions.MailStorageOptions.TextFilter="Viewer";viewOptions.MailStorageOptions.AddressFilter="groupdocs@mail.com";viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.nsf")' Create an HTML file.
DimviewOptions=HtmlViewOptions.ForEmbeddedResources()' Set filters.
viewOptions.MailStorageOptions.TextFilter="Viewer"viewOptions.MailStorageOptions.AddressFilter="groupdocs@mail.com"viewer.View(viewOptions)EndUsingEndSubEndModule
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.