GroupDocs.Viewer for .NET allows you to render Project files in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft Project or other project management software to load and view Project files within your .NET application (web or desktop).
To start using 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.
GroupDocs.Viewer can detect the document format automatically based on information in the file header.
Note
On Linux, rendering Project Management files (MPP, MPT, and MPX) requires the Microsoft TrueType core fonts (the ttf-mscorefonts-installer package). Without them, rendering fails with Cannot find fallback font 'Generic Sans Serif'. See System requirements.
Render Project files as HTML
Create an HtmlViewOptions class instance and pass it to the Viewer.View method to convert a Project file to HTML. The HtmlViewOptions class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: Rendering to HTML.
Create an HTML file with embedded resources
To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the HtmlViewOptions.ForEmbeddedResources method and specify the output file name.
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Render the project's active view as HTML.// {0} is replaced with the current page number in the output file names.varviewOptions=HtmlViewOptions.ForEmbeddedResources("page_{0}.html");viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Render the project's active view as HTML.
' {0} is replaced with the current page number in the output file names.
DimviewOptions=HtmlViewOptions.ForEmbeddedResources("page_{0}.html")viewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the HtmlViewOptions.ForExternalResources method and pass the following parameters:
The output file path format
The path format for the folder with external resources
The resource URL format
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Render the project's active view as HTML.// Specify the HTML file names and location of external resources.// {0} and {1} are replaced with the page number and resource name, respectively.varviewOptions=HtmlViewOptions.ForExternalResources("page_{0}.html","page_{0}/resource_{0}_{1}","page_{0}/resource_{0}_{1}");viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Render the project's active view as HTML.
' Specify the HTML file names and location of external resources.
' {0} and {1} are replaced with the page number and resource name, respectively.
DimviewOptions=HtmlViewOptions.ForExternalResources("page_{0}.html","page_{0}/resource_{0}_{1}","page_{0}/resource_{0}_{1}")viewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
External resources are placed in a separate folder.
Render Project files as PDF
Create a PdfViewOptions class instance and pass it to the Viewer.View method to convert a Project 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.mpp")){// Create a PDF file for the project's active view.varviewOptions=newPdfViewOptions("output.pdf");viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Create a PDF file for the project's active view.
DimviewOptions=NewPdfViewOptions("output.pdf")viewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Render the project's active view as PNG.// {0} is replaced with the current page number in the output file names.varviewOptions=newPngViewOptions("output_{0}.png");// Set width and height.viewOptions.Width=1600;viewOptions.Height=650;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Render the project's active view as PNG.
' {0} is replaced with the current page number in the output file names.
DimviewOptions=NewPngViewOptions("output_{0}.png")' Set width and height.
viewOptions.Width=1600viewOptions.Height=650viewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Render the project's active view as JPEG.// {0} is replaced with the current page number in the output file names.varviewOptions=newJpgViewOptions("output_{0}.jpg");// Set width and height.viewOptions.Width=1600;viewOptions.Height=650;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Render the project's active view as JPEG.
' {0} is replaced with the current page number in the output file names.
DimviewOptions=NewJpgViewOptions("output_{0}.jpg")' Set width and height.
viewOptions.Width=1600viewOptions.Height=650viewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
Use the ProjectManagementViewInfo class properties to retrieve information about the Project file.
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;usingGroupDocs.Viewer.Results;// ...using(varviewer=newViewer("sample.mpp")){varviewInfoOptions=ViewInfoOptions.ForHtmlView();varviewInfo=viewer.GetViewInfo(viewInfoOptions)asProjectManagementViewInfo;if(viewInfo!=null){// Display information about the Project file.Console.WriteLine($"File type: {viewInfo.FileType}");Console.WriteLine($"The number of pages: {viewInfo.Pages.Count}");Console.WriteLine($"Project start date: {viewInfo.StartDate}");Console.WriteLine($"Project end date: {viewInfo.EndDate}");}}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.OptionsImportsGroupDocs.Viewer.Results' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")DimviewInfoOptions=ViewInfoOptions.ForHtmlView()DimviewInfo=TryCast(viewer.GetViewInfo(viewInfoOptions),ProjectManagementViewInfo)IfviewInfoIsNotNothingThen' Display information about the Project file.
Console.WriteLine($"File type: {viewInfo.FileType}")Console.WriteLine($"The number of pages: {viewInfo.Pages.Count}")Console.WriteLine($"Project start date: {viewInfo.StartDate}")Console.WriteLine($"Project end date: {viewInfo.EndDate}")EndIfEndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
File type: Microsoft Project File (.mpp)
The number of pages: 1
Project start date: 9/7/2026 12:00:00 AM
Project end date: 1/20/2027 12:00:00 AM
GroupDocs.Viewer allows you to specify page size for the output file when you convert your Project document to HTML, PDF, or image format. Assign a PageSize enumeration member to the ProjectManagementOptions.PageSize property to select one of the predefined page sizes (Letter, Ledger, A0, A1, A2, A3, or A4). You can access this property for the following classes (depending on the output file format):
The following example specifies page size for the output PDF file:
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Convert the document to PDF.varviewOptions=newPdfViewOptions("output.pdf");// Specify the page size.viewOptions.ProjectManagementOptions.PageSize=PageSize.A3;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Convert the document to PDF.
DimviewOptions=NewPdfViewOptions("output.pdf")' Specify the page size.
viewOptions.ProjectManagementOptions.PageSize=PageSize.A3viewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
When rendering a Project file, GroupDocs.Viewer selects the smallest time unit on a timescale based on the total length of the project. You can adjust the timescale to show smaller or greater time units (from days to months). To do this, set the ViewOptions.ProjectManagementOptions.TimeUnit property for a target view to one of the following TimeUnit enumeration members:
Days displays days on the timescale.
ThirdsOfMonths displays the Beginning/Middle/End (B/M/E) of each month on the timescale.
Months displays months on the timescale.
Unspecified means that the timescale unit is not specified.
The following code sample demonstrates how to specify the timescale unit when rendering a Project file to HTML:
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Convert the document to HTML.// {0} is replaced with the current page number in the file name.varviewOptions=HtmlViewOptions.ForEmbeddedResources("output_{0}.html");// Specify the time unit.viewOptions.ProjectManagementOptions.TimeUnit=TimeUnit.ThirdsOfMonths;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Convert the document to HTML.
' {0} is replaced with the current page number in the file name.
DimviewOptions=HtmlViewOptions.ForEmbeddedResources("output_{0}.html")' Specify the time unit.
viewOptions.ProjectManagementOptions.TimeUnit=TimeUnit.ThirdsOfMonthsviewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
With GroupDocs.Viewer, you can render only a portion of the project’s timeline when you convert your Project file to HTML, PDF, or image format. Set the ViewOptions.ProjectManagementOptions.StartDate and ViewOptions.ProjectManagementOptions.EndDate properties for a target view to specify a date range the timeline should display. If you set only the StartDate property, the timeline displays information for tasks from the specified date to the project’s finish date. If you set only the EndDate property, the timeline contains dates from the project’s start date to the specified date.
The example below demonstrates how to convert a Project file to PDF and set the timeline date range.
usingSystem;usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Convert the document to PDF.varviewOptions=newPdfViewOptions("output.pdf");// Specify the date range.viewOptions.ProjectManagementOptions.StartDate=newDateTime(2026,10,01);viewOptions.ProjectManagementOptions.EndDate=newDateTime(2026,12,01);viewer.View(viewOptions);}
ImportsSystemImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Convert the document to PDF.
DimviewOptions=NewPdfViewOptions("output.pdf")' Specify the date range.
viewOptions.ProjectManagementOptions.StartDate=NewDateTime(2026,10,01)viewOptions.ProjectManagementOptions.EndDate=NewDateTime(2026,12,01)viewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.
Microsoft Project allows you to add notes to tasks, resources, and assignments.
If you need to display these notes in the output HTML, PDF, or image files, enable the ViewOptions.RenderNotes property for a target view.
The following code sample converts a Project file with task notes to PDF:
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(varviewer=newViewer("sample.mpp")){// Convert the document to PDF.varviewOptions=newPdfViewOptions("output.pdf");// Enable notes rendering.viewOptions.RenderNotes=true;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())Usingviewer=NewViewer("sample.mpp")' Convert the document to PDF.
DimviewOptions=NewPdfViewOptions("output.pdf")' Enable notes rendering.
viewOptions.RenderNotes=Trueviewer.View(viewOptions)EndUsingEndSubEndModule
sample.mpp is the sample file used in this example. Click here to download it.