GroupDocs.Viewer for .NET Introduction (click to expand)
GroupDocs.Viewer for .NET is a versatile API designed for developers to render and convert over 100+ file formats into HTML, PDF, or images with unmatched accuracy. It supports advanced features like document streaming, email attachment handling, custom headers, responsive layouts, and CAD rendering without requiring external software like Microsoft Office. Whether you are working with Word, Excel, Visio, or archive files, GroupDocs.Viewer for .NET ensures seamless integration into .NET web and desktop applications, optimizing file rendering for enhanced user experiences.
GroupDocs.Viewer for .NET Features
Render Word Documents
Render Word Documents as HTML, PDF, and Images
Convert Word documents to HTML, PDF, PNG, or JPEG without using Microsoft Word, suitable for .NET web or desktop apps.
Render PDF Documents
Render PDF Documents as Images
Convert PDF documents to image formats such as PNG or JPEG, ensuring quality control for .NET applications.
Render Spreadsheet Files
Render Excel and Apple Numbers Spreadsheets
Render Excel and Apple Numbers spreadsheets to HTML, PDF, PNG, or JPEG, providing flexibility in .NET applications.
Split a Worksheet into Pages
Split Excel worksheets into pages using custom row or column settings, making large sheets easier to manage in rendering.
Render PowerPoint Presentations
Render PowerPoint Presentations to PDF and Images
Convert PowerPoint slides to PDF, PNG, or JPEG for easy sharing and viewing in .NET projects.
Render Visio Documents
Render Visio Diagrams to PDF and Images
Convert Visio diagrams to PDF, PNG, or JPEG for integration into .NET solutions.
Render CAD Files
Render CAD Drawings and Models
Convert CAD drawings to PDF or image formats for viewing within .NET apps without specialized CAD software.
Specify Rendering Options
Customize CAD Rendering
Use the CadOptions class to specify different settings such as background color and output image size for rendering CAD files to formats like PDF, PNG, and JPEG.
Render Project Files
Render Microsoft Project (.MPP) and other project management files to HTML, PDF, PNG, and JPEG without needing project management software.
Adjust Project Rendering Options
Control output page size, adjust time units, and render specific project details like task notes and specific dates for comprehensive project representation.
Render EBooks
Convert EBooks to HTML, PDF, and Images
Render EPUB, MOBI, and AZW3 eBooks to HTML, PDF, PNG, or JPEG without needing a dedicated book reader.
Render Web Documents
Render Web Documents as PDF or Images
Render HTML, MHTML, and CHM files into PDF, PNG, or JPEG formats with customizable rendering settings, such as page size and margins.
Render XML Documents
Advanced XML Rendering
Process XML documents using an advanced module to ensure correct formatting, highlighting, and pagination, even for heavily corrupted XML structures.
Render Text Documents
Convert Text Documents to Multiple Formats
Render text documents, including XML, to formats like HTML, PDF, and image files, with enhanced options for styling and structuring.
Render Images
Image Conversion to PDF, HTML, or PNG
Render raster images such as JPEG, PNG, and BMP into PDF, HTML, and other formats, with options to adjust output dimensions and quality.
Render Email Messages
Render Email Messages
Render emails in formats like EML, MSG, and MHT to HTML, PDF, or images, supporting different rendering scenarios including attachments.
Render Outlook Data Files
Convert PST and OST Files
Render Outlook PST and OST data files to view their contents, including emails and attachments, in HTML, PDF, or image formats.
Render Lotus Notes Database Files
Render NSF Files
Convert Lotus Notes NSF files to HTML, PDF, or image formats for easy viewing of emails, attachments, and other elements within the database.
Render Archive Files
Render Archive as HTML
Convert archive files such as .ZIP, .RAR, and .7Z to HTML for easy viewing in web browsers.
Render Archive as PDF
Render archive contents into a consolidated PDF file for documentation or sharing purposes.
Render Archive as Images (PNG, JPEG)
Convert archive files into individual images in formats like PNG or JPEG for visual previews.
Load Documents
Load Documents from Local Path
Load a document from a local file system path using GroupDocs.Viewer for rendering.
Load from Stream
Load documents from a memory stream for flexibility in handling file input sources.
Load from URL
Load documents directly from URLs, enabling remote document rendering.
Load from FTP
Load documents stored on an FTP server for easy access and viewing.
Load from Amazon S3 Storage
Load documents directly from Amazon S3 buckets using AWS credentials.
Load from Azure Blob Storage
Load documents from Azure Blob Storage, integrating cloud document access.
Load Password-Protected Documents
Load documents that are protected by passwords, ensuring secure handling of sensitive files.
Document Loading Features
Specify File Type When Loading a Document
Use LoadOptions
to specify the file type directly, bypassing automatic detection for better performance.
Specify Encoding When Loading Documents
Control character encoding when loading documents using LoadOptions
to ensure accurate content display.
Loading of External Resources Contained by a Document
Manage the loading of external resources such as images by configuring LoadOptions
to either skip or whitelist resources for secure processing.
Retrieve properties such as format family and page count after loading a document to facilitate document rendering or analysis.
Determine File Type
Determine a file type based on extension, media type, or file signature using FileType
methods like FromExtension()
, FromMediaType()
, or FromStream()
.
Get detailed information about the format family to categorize different document formats, such as archives or email files.
Check if a File is Encrypted
Verify whether a file is encrypted by using GetFileInfo()
after loading the document, enabling you to handle security features effectively.
Render Documents
List and Print All Supported File Types
Use FileType.GetSupportedFileTypes()
to list all supported file types for rendering in your .NET application.
Get the Width and Height of Document Pages
Use viewer.GetViewInfo()
to obtain the width and height of each page in a document.
Render Specific Pages
Render only selected pages by specifying them in the View()
method either as parameters or by using an array.
Cancel Rendering
Cancel ongoing rendering operations if required to halt the process in real-time.
Render Hidden Pages
Use advanced rendering settings to include hidden pages in the output when necessary.
Rotate Pages
Rotate pages in your document by utilizing the RotatePage
method from the ViewOptions
class.
Set Custom Fonts
Specify custom fonts to be used when rendering documents to maintain consistency in the output.
Replace Missing Fonts
Replace missing fonts in documents with specific fonts to ensure proper formatting when rendered.
Save Output and Watermark Features
Save Output to Stream
GroupDocs.Viewer allows saving output results to a stream, offering flexibility when rendering to different formats like PDF, HTML, or images.
Add Text Watermarks
Add watermarks to HTML, JPG, PNG, or PDF outputs with simple methods to protect and personalize rendered documents.
HTML Rendering Features
Render to HTML
Convert documents to HTML while embedding or storing resources externally, providing control over document output for web viewing.
Render with Responsive Layout
Enable responsive layout when rendering documents to HTML for consistent viewing across various device types.
Optimize Output for Printing
Use the ForPrinting
property to render HTML optimized for print, supporting vector formats like SVG for enhanced quality.
Minify HTML
Minify generated HTML files to reduce size and improve loading speed, particularly useful for web-based viewers.
Exclude Fonts
Exclude unnecessary fonts from the output to minimize the size of the rendered HTML files.
Image Rendering Features
Render to PNG or JPEG
Convert documents to high-quality PNG or JPEG images, specifying output quality and resolution to meet your needs.
Adjust Image Size
Control the size of output images when rendering to PNG or JPEG to optimize for bandwidth and quality requirements.
Rendering Options for PDF and Images
Adjust JPEG Image Quality
Decrease JPEG quality to reduce file size by setting JpgQuality
in PdfViewOptions
(value between 1-100, default is 90).
Get Text Coordinates
Extract text coordinates in rendered images using ViewInfoOptions.ForPngView()
and analyze the text, words, and character locations.
Set Image Size Limits
Set maximum width and height for output images using ImageMaxWidth
and ImageMaxHeight
properties in HtmlViewOptions
or JpgViewOptions
.
Render to PDF with Custom Quality
Set image quality in rendered PDFs using PdfOptimizationOptions.ImageQuality
to adjust JPEG image quality within the output PDF.
Reorder Pages in PDF
Specify the order of rendered pages by setting the page numbers in PdfViewOptions
using the Viewer.View()
method.
Protect PDF Document
Add password protection to the output PDF by using the Security
option during rendering.
Optimize PDF Output
Minimize output file size by removing unused resources and subsetting fonts during rendering.
PDF File Optimization Features
Optimize PDF File Resources
Reduce the output PDF file size by optimizing images, fonts, form fields, and other document components for efficient storage and faster loading.
Optimize Spreadsheets in PDF Files
Optimize embedded spreadsheets to reduce the overall PDF file size by removing unnecessary borders and specific fonts.
Optimize Images
Reduce image quality, set specific image resolutions, or convert images to grayscale to minimize the PDF file size.
Reduce Image Quality
Enable image compression and adjust the image quality percentage to lower the file size while maintaining acceptable visual quality.
Set Image Resolution
Set a maximum image resolution for the output PDF to optimize file size and enhance loading efficiency.
Convert to Grayscale
Convert images within the PDF to grayscale to further reduce the file size and simplify document content.
Optimize Fonts
Subset fonts used in the PDF file to remove unnecessary characters, reducing the file size without impacting the document’s appearance.
Remove Annotations
Remove any annotations present in the PDF to optimize file size and enhance readability.
Remove fillable form fields in the output PDF to minimize its size while retaining static content.
Optimize PDF File for Browser
Optimize the output PDF file for faster rendering in web browsers, allowing partial download for quick viewing of the first pages.
PDF File Optimization Features
Subset Fonts in PDF
Reduce file size by removing unused instructions from embedded fonts in a PDF by setting the SubsetFonts
property to true
.
Remove Unused Resources in PDF
Optimize PDF files by removing unused resources, such as orphaned objects or unnecessary data streams, to reduce the document size effectively.
Process Attachments
List Attachments
List attachments from emails, PDFs, Outlook, Lotus Notes, and compressed files with GroupDocs.Viewer using the GetAttachments
method.
Save Attachments
Save attachments from supported documents, such as emails and compressed files, by iterating through the attachment collection and using the SaveAttachment
method.
Render Attachments
Render document attachments just like any other document by saving and viewing the attachments with the specified view options.
Caching Features
Custom Cache Implementation
Implement a custom caching solution for GroupDocs.Viewer to store document cache in third-party storage like FTP, Amazon S3, Google Drive, or Redis.
Thread-Safe Cache for GroupDocs.Viewer
Create a thread-safe cache for GroupDocs.Viewer to ensure consistent and reliable caching during concurrent access.
Logging
Logging Support
Implement logging in GroupDocs.Viewer to keep track of document rendering and processing operations, ensuring smooth troubleshooting and debugging.
Format | Description | Automatic Format Detection |
---|
7Z | 7-Zip Compressed File | ✔️️ |
BZ2 | Bzip2 Compressed File | ✔️️ |
GZ | Gnu Zipped Archive | ✔️️ |
RAR | WinRAR Compressed Archive | ✔️️ |
TAR | Consolidated Unix File Archive | ✔️️ |
TGZ | Gzipped Tar File | ✔️️ |
TXZ | XZ Compressed Tar Archive | ✔️️ |
XZ | XZ Compressed Archive | ✔️️ |
ZIP | Zipped File | ✔️️ |
Zstandard | Zstandard Archive | ✔️️ |
ISO | Optical Disk Image | ✔️️ |
Format | Description | Automatic Format Detection | Remarks |
---|
CF2 | Common File Format | ✔️ | |
DGN | MicroStation Design File (V7) | ✔️ | DGN V8 is not supported as the file format is proprietary. |
DWF | Design Web Format | ✔️ | |
DWG | AutoCAD Drawing | ✔️ | Supported formats: Release 11, 12, 13, 14; DWG 2000, 2000i, 2002; DWG 2004, 2005, 2006; DWG 2010-2016. |
DWT | AutoCAD Drawing Template | ✔️ | |
DXF | Drawing Exchange Format | ✔️ | |
HPG | HPGL (Hewlett-Packard Graphics Language) Plot File | ✔️ | |
IFC | Industry Foundation Classes | ✔️ | |
IGS | IGES (Initial Graphics Exchange Specification) Drawing | ✔️ | |
OBJ | Wavefront 3D Object File | ✔️ | |
PLT | AutoCAD Plotter Document | ✔️ | |
STL | Stereolithography File | ✔️ | |
Format | Description | Automatic Format Detection |
---|
NSF | Lotus Notes Database File | ✔️ |
Format | Description | Automatic Format Detection |
---|
EPUB | Open EBook Format | ✔️ |
MOBI | Mobipocket EBook | ✔️ |
AZW3 | AZ3/KF8 EBook Format | ✔️ |
Format | Description | Automatic Format Detection |
---|
EML | Email Message | ✔️ |
EMLX | Apple Mail Message | ✔️ |
MBOX | Email Mailbox File | ✔️ |
MSG | Outlook Message Item File | ✔️ |
VCARD / VCF | vCard (Virtual Contact) File | ✔️ |
Format | Description | Automatic Format Detection | Remarks |
---|
AI * | Adobe Illustrator Artwork | ✔️ | Supported versions: 2, 3, 8. |
APNG | Animated Portable Network Graphic | ✔️ | |
BMP | Bitmap Image | ✔️ | |
CDR | CorelDRAW Image File | ✔️ | |
CGM | Computer Graphics Metafile | ✔️ | |
CMX | Corel Presentation Exchange Image | ✔️ | Supported version: 2.0 with 32-bit precision (16-bit precision is partially supported). |
DCM | DICOM (Digital Imaging and Communications in Medicine) Image | ✔️ | |
DIB | Device Independent Bitmap File | ✔️ | |
DJVU | DjVu Image | ✔️ | |
DNG | Digital Negative Image | ✔️ | |
EMF | Enhanced Windows Metafile | ✔️ | |
EMZ | Windows Compressed Enhanced Metafile | ✔️ | |
EPS | Encapsulated PostScript File | ✔️ | |
FODG | OpenDocument Flat XML Graphics | ✔️ | |
GIF | Graphical Interchange Format | ✔️ | |
ICO | Windows Icon File | ✔️ | |
J2C | JPEG 2000 Code Stream | ✔️ | |
J2K | JPEG 2000 Image | ✔️ | |
JP2 | JPEG 2000 Core Image File | ✔️ | |
JPC | JPEG 2000 Code Stream File | ✔️ | |
JPEG / JPG | JPEG Image | ✔️ | |
JFIF | JPEG File Interchange Format | ✔️ | |
JPF | JPEG 2000 Image | ✔️ | |
JPM | JPEG 2000 Multi-layer Image Format | ✔️ | |
JPX | JPEG 2000 Image File | ✔️ | |
JLS | JPEG-LS Image | ✔️ | |
ODG | OpenDocument Graphics File | ✔️ | |
OTG | OpenDocument Graphics Template | ✔️ | |
PCL | Printer Command Language Document | ✔️ | |
PNG | Portable Network Graphics | ✔️ | |
PS | PostScript File | ✔️ | |
PSB * | Photoshop Large Document Format | ✔️ | |
PSD * | Adobe Photoshop Document | ✔️ | |
SVG | Scalable Vector Graphics File | ✔️ | |
SVGZ | Compressed SVG File | ✔️ | |
TGA | TARGA (Truevision Advanced Raster Graphics Adapter) Graphics | ✔️ | |
TIF / TIFF | Tagged Image File Format | ✔️ | |
WEBP | WebP Image | ✔️ | |
WMF | Windows Metafile | ✔️ | |
WMZ | Compressed Windows Metafile | ✔️ | |
Note
AI
, PSB
, and PSD
formats, marked by asterisk (*), currently are not supported by the GroupDocs.Viewer.CrossPlatform.
Note
Note file formats family currently is not supported by the GroupDocs.Viewer.CrossPlatform.
Format | Description | Automatic Format Detection |
---|
ONE | Microsoft OneNote Document | ✔️ |
Format | Description | Automatic Format Detection |
---|
OST | Outlook Offline Storage Table | ✔️ |
PST | Outlook Personal Storage Table | ✔️ |
PDF and Page Layout File Formats
Format | Description | Automatic Format Detection |
---|
OXPS | OpenXPS (Open XML Paper Specification) File | ✔️ |
PDF | Adobe Portable Document Format | ✔️ |
TEX | LaTeX Source Document | ✔️ |
XPS | Microsoft XML Paper Specification | ✔️ |
Format | Description | Automatic Format Detection |
---|
FODP | OpenDocument Flat XML Presentation | ✔️ |
ODP | OpenDocument Presentation | ✔️ |
OTP | OpenDocument Presentation Template | ✔️ |
POT | Microsoft PowerPoint 97-2003 Template | ✔️ |
POTM | Microsoft PowerPoint Macro-Enabled Template | ✔️ |
POTX | Microsoft PowerPoint Template | ✔️ |
PPS | Microsoft PowerPoint 97-2003 Slide Show | ✔️ |
PPSM | Microsoft PowerPoint Macro-Enabled Slide Show | ✔️ |
PPSX | Microsoft PowerPoint Slide Show | ✔️ |
PPT | Microsoft PowerPoint 97-2003 Presentation | ✔️ |
PPTM | Microsoft PowerPoint Macro-Enabled Presentation | ✔️ |
PPTX | Microsoft PowerPoint Presentation | ✔️ |
Note
Project Management file formats family currently is not supported by the GroupDocs.Viewer.CrossPlatform.
Format | Description | Automatic Format Detection |
---|
MPP | Microsoft Project | ✔️ |
MPT | Microsoft Project Template | ✔️ |
MPX | Microsoft Project Exchange File | ✔️ |
Format | Description | Automatic Format Detection | Remarks |
---|
CSV | Comma Separated Values File | ✔️ | |
FODS | OpenDocument Flat XML Spreadsheet | ✔️ | |
NUMBERS | Apple Numbers Spreadsheet | ✔️ | GroupDocs.Viewer supports version 3.5 and higher starting with v21.8. |
ODS | OpenDocument Spreadsheet | ✔️ | |
OTS | OpenDocument Spreadsheet Template | ✔️ | |
SXC | StarOffice Calc Spreadsheet | ✔️ | |
TSV | Tab Separated Values File | ✔️ | |
XLS | Microsoft Excel 97-2003 Workbook | ✔️ | Supported formats: Excel 2003 (11.0), Excel 2002 (10.0), Excel 2000 (9.0), Excel 97 (8.0), Excel 95 (7.0), Excel 5.0. |
XLSB | Microsoft Excel Binary Workbook | ✔️ | |
XLSM | Microsoft Excel Macro-Enabled Workbook | ✔️ | |
XLSX | Microsoft Excel Workbook | ✔️ | |
XLT | Microsoft Excel 97-2003 Template | ✔️ | Supported formats: Excel 2003 (11.0), Excel 2002 (10.0), Excel 2000 (9.0), Excel 97 (8.0). |
XLTX | Microsoft Excel Template | ✔️ | |
XLTM | Microsoft Excel Macro-Enabled Template | ✔️ | |
XLAM | Microsoft Excel Add-In | ✔️ | |
XML | XML Spreadsheet 2003 | ✔️ | |
Text and Programming File Formats
Format | Description | Automatic Format Detection |
---|
AS / AS3 | ActionScript File | |
ASM | Assembly Language Source Code File | |
BAT | DOS Batch File | |
C | C/C++ Source Code File | |
CC | C++ Source Code File | |
CMAKE | CMake File | |
CPP | C++ Source Code File | |
CS | C# Source Code File | ✔️ |
CSS | Cascading Style Sheet | |
CXX | C++ Source Code File | |
DIFF | Patch File | |
ERB | Ruby ERB Script | |
GROOVY | Groovy Source Code File | |
H | C/C++/Objective-C Header File | |
HAML | Haml Source Code File | |
HH | C++ Header File | |
JAVA | Java Source Code File | |
JS | JavaScript File | |
JSON | JavaScript Object Notation File | |
LESS | LESS Style Sheet | |
LOG | Log File | |
M | Objective-C Implementation File | |
MAKE | Xcode Makefile Script | |
MD | Markdown Documentation File | |
ML | ML Source Code File | |
MM | Objective-C++ Source File | |
PHP | PHP Source Code File | |
PL | Perl Script | |
PROPERTIES | Java Properties File | |
PY | Python Script | |
RB | Ruby Source Code | |
RST | reStructuredText File | |
SASS | Syntactically Awesome StyleSheets File | |
SCALA | Scala Source Code File | |
SCM | Scheme Source Code File | |
SCRIPT | Generic Script File | |
SH | Bash Shell Script | |
SML | Standard ML Source Code File | |
SQL | Structured Query Language Data File | |
TXT | Plain Text File | ✔️ |
VB | Visual Basic Source Code File | ✔️ |
VIM | Vim Settings File | |
XML | XML File | ✔️ |
YAML | YAML Document | |
Note
Visio file formats family currently is not supported by the GroupDocs.Viewer.CrossPlatform.
Format | Description | Automatic Format Detection |
---|
VDW | Visio Web Drawing | ✔️ |
VDX | Visio Drawing XML File | ✔️ |
VSD | Visio 2003-2010 Drawing | ✔️ |
VSDM | Visio Macro-Enabled Drawing | ✔️ |
VSDX | Visio Drawing | ✔️ |
VSS | Visio 2003-2010 Stencil | ✔️ |
VSSM | Visio Macro-Enabled Stencil | ✔️ |
VSSX | Visio Stencil | ✔️ |
VST | Visio 2003-2010 Template | ✔️ |
VSTM | Visio Macro-Enabled Template | ✔️ |
VSTX | Visio Template | ✔️ |
VSX | Visio Stencil XML File | ✔️ |
VTX | Visio Template XML File | ✔️ |
Format | Description | Automatic Format Detection |
---|
CHM | Compiled HTML Help Format | ✔️ |
HTML | Hypertext Markup Language Format | ✔️ |
MHT | MHTML Web Archive | ✔️ |
MHTML | MIME HTML Format | ✔️ |
Format | Description | Automatic Format Detection |
---|
DOC | Microsoft Word 97-2003 Document | ✔️ |
DOCM | Microsoft Word Macro-Enabled Document | ✔️ |
DOCX | Microsoft Word Document | ✔️ |
DOT | Microsoft Word 97-2003 Template | ✔️ |
DOTM | Microsoft Word Macro-Enabled Template | ✔️ |
DOTX | Microsoft Word Template | ✔️ |
ODT | OpenDocument Text | ✔️ |
OTT | OpenDocument Text Template | ✔️ |
RTF | Rich Text Document | ✔️ |
System Requirements
Note:
GroupDocs.Viewer for .NET (including GroupDocs.Viewer.CrossPlatform) does not require external software like Microsoft Word, Excel, or PowerPoint.
Supported Operating Systems
GroupDocs.Viewer for .NET
- Windows
- Windows Server 2003+
- Windows XP, Vista, 7, 8, 8.1, 10, 11 (x64, x86)
- Linux
- Supported distributions include Ubuntu, OpenSUSE, CentOS, and others.
- Mac
- Windows
- Windows 7.1 SP1, 8.1, 10 (v1607+), 11 (v22000+), Server 2012+, Server Core 2012+, Nano Server (v1809+).
- Linux
- Supports distributions like Ubuntu, OpenSUSE, CentOS, and others.
- Mac
Supported Frameworks and Runtimes
Development Environments
- Microsoft Visual Studio 2010+
- Microsoft Visual Studio for Mac
- JetBrains Rider
Install GroupDocs.Viewer for .NET
Add GroupDocs.Viewer to your .NET project using NuGet or by downloading the required DLLs.
Choose the correct package.
GroupDocs.Viewer
- Target Frameworks: .NET Framework 4.6.2+, .NET 6.0.
- Dependencies: System.Drawing(.Common).
- Target Frameworks: .NET 6.0+.
- Preferred for: Linux and macOS.
Install Using NuGet
You can install the library using:
- NuGet Package Manager
Open Manage NuGet Packages in Visual Studio, search for GroupDocs.Viewer
or GroupDocs.Viewer.CrossPlatform
, select the latest version, and click Install. - Package Manager Console
Run the following commands in Visual Studio:Install-Package GroupDocs.Viewer
Install-Package GroupDocs.Viewer.CrossPlatform
- .NET CLI
Run the following commands in your terminal:dotnet add package GroupDocs.Viewer
dotnet add package GroupDocs.Viewer.CrossPlatform
Download from the Website
- Visit GroupDocs Viewer Releases.
- Download the ZIP archive or MSI installer.
- Add the
GroupDocs.Viewer.dll
to your project:- Extract the archive or install the package.
- In Visual Studio, right-click References/Dependencies → Add Reference.
- Locate and select
GroupDocs.Viewer.dll
.
Render Email Messages as HTML with Embedded Resources
Convert email messages into a fully functional HTML file with all external resources embedded, ensuring a seamless viewing experience within your .NET application.
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// Initialize Viewer for the email file
using (var viewer = new Viewer("sample.eml"))
{
// Configure to create an HTML file with embedded resources
var viewOptions = HtmlViewOptions.ForEmbeddedResources("output.html");
viewer.View(viewOptions);
}
// Result: Generates an HTML file containing the email's content with all resources included.
Convert Documents to Optimized PDF
Transform your documents into optimized, browser-ready PDF files while preserving quality and minimizing file size.
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// Initialize Viewer for the document
using (var viewer = new Viewer("sample.docx"))
{
// Configure output to be a PDF
var viewOptions = new PdfViewOptions("output.pdf");
// Enable optimization for browsers
viewOptions.OptimizeForBrowser();
viewer.View(viewOptions);
}
// Result: Generates a PDF file optimized for web browsers.
Modify the labels of standard email header fields such as “From,” “To,” and “Subject” for personalized rendering in HTML format.
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// Initialize Viewer for the email file
using (var viewer = new Viewer("sample.eml"))
{
// Configure output as an HTML file with custom header labels
var viewOptions = HtmlViewOptions.ForEmbeddedResources("output_custom.html");
viewOptions.EmailOptions.FieldTextMap[Field.From] = "Sender";
viewOptions.EmailOptions.FieldTextMap[Field.To] = "Recipient";
viewOptions.EmailOptions.FieldTextMap[Field.Subject] = "Email Subject";
viewer.View(viewOptions);
}
// Result: Creates an HTML file with customized email header labels.
