Skip to content

Commit

Permalink
Updated rendering doc html
Browse files Browse the repository at this point in the history
  • Loading branch information
muqarrab-aspose committed Mar 13, 2024
1 parent a35e747 commit 2b125b9
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 103 deletions.
6 changes: 5 additions & 1 deletion content/english/net/rendering-documents-html/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ url: /net/rendering-documents-html/

## Rendering Documents to HTML Tutorials
### [Exclude Fonts from Rendered HTML](./exclude-fonts-html/)
Learn how to exclude fonts from rendered HTML using GroupDocs.Viewer for .NET. Follow this step-by-step guide for seamless document display.
### [Minify Rendered HTML Document](./minify-html/)
Learn how to seamlessly render HTML documents in .NET applications using GroupDocs.Viewer for .NET.
### [Render with Embedded or External Resources](./render-html-resources/)
### [Render Responsive HTML](./render-responsive-html/)
Enhance .NET document viewing with GroupDocs.Viewer for seamless rendering. Follow our tutorial for efficient integration and superior user experience.
### [Render Responsive HTML](./render-responsive-html/)
Learn how to render responsive HTML using Groupdocs.Viewer for .NET, ensuring optimal viewing experience across devices.
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,72 @@
title: Exclude Fonts from Rendered HTML
linktitle: Exclude Fonts from Rendered HTML
second_title: GroupDocs.Viewer .NET API
description:
description: Learn how to exclude fonts from rendered HTML using GroupDocs.Viewer for .NET. Follow this step-by-step guide for seamless document display.
type: docs
weight: 10
url: /net/rendering-documents-html/exclude-fonts-html/
---
## Introduction
GroupDocs.Viewer for .NET is a powerful document rendering library that allows developers to display over 50 document formats in their .NET applications without the need for external dependencies. In this tutorial, we'll focus on a specific feature of GroupDocs.Viewer: excluding fonts from rendered HTML output.
## Prerequisites
Before you begin, ensure you have the following:
1. Basic understanding of C# and .NET development.
2. GroupDocs.Viewer for .NET installed. You can download it from [here](https://releases.groupdocs.com/viewer/net/).
3. Visual Studio or any other IDE for C# development.

## Complete Source Code
## Import Namespaces
In your C# code, make sure to include the necessary namespaces:
```csharp
using System;
using System.IO;
using GroupDocs.Viewer.Options;
```

namespace GroupDocs.Viewer.Examples.CSharp.BasicUsage.RenderDocumentToHtml
## Step 1: Define Output Directory
Set up the directory where you want the rendered HTML files to be saved.
```csharp
string outputDirectory = "Your Document Directory";
```
## Step 2: Define Page File Path Format
Specify the format for the file paths of individual pages of the rendered document.
```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.html");
```
## Step 3: Initialize Viewer Object
Instantiate the Viewer object with the document you want to render.
```csharp
using (Viewer viewer = new Viewer("YourDocumentPath"))
{
/// <summary>
/// This example demonstrates how to exclude Arial font from the output when rendering into HTML.
/// </summary>
class ExcludingFontsFromOutputHtml
{
public static void Run()
{
string outputDirectory = "Your Document Directory";
string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.html");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_DOCX))
{
HtmlViewOptions options =
HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
options.FontsToExclude.Add("Arial");

viewer.View(options);
}

Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
}
}
// Your code goes here
}

```
## Step 4: Set HTML View Options
Define the options for HTML rendering, including the format of embedded resources and fonts to exclude.
```csharp
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
options.FontsToExclude.Add("Arial");
```
## Step 5: Render Document
Pass the HTML view options to the Viewer object to render the document.
```csharp
viewer.View(options);
```
## Step 6: Output Rendered Document Location
Inform the user about the location where the rendered HTML files are saved.
```csharp
Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
```

## Conclusion
In this tutorial, we've learned how to use GroupDocs.Viewer for .NET to exclude fonts from rendered HTML output. By following the steps outlined above, you can customize the rendering process to meet your specific requirements, ensuring optimal display of documents in your applications.
## FAQ's
### Can I exclude multiple fonts from the rendered HTML?
Yes, you can add multiple font names to the `FontsToExclude` list in the HTML view options.
### Is GroupDocs.Viewer compatible with all .NET frameworks?
Yes, GroupDocs.Viewer supports .NET Framework 4.6.1 and higher.
### Can I render documents from remote storage locations?
Yes, GroupDocs.Viewer supports rendering documents from local storage as well as remote storage locations and streams.
### Does GroupDocs.Viewer support responsive design for HTML output?
Yes, you can enable responsive rendering by adjusting the HTML view options accordingly.
### Is technical support available for GroupDocs.Viewer?
Yes, you can seek assistance and participate in discussions on the [GroupDocs.Viewer forum](https://forum.groupdocs.com/c/viewer/9).
80 changes: 55 additions & 25 deletions content/english/net/rendering-documents-html/minify-html/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,71 @@
title: Minify Rendered HTML Document
linktitle: Minify Rendered HTML Document
second_title: GroupDocs.Viewer .NET API
description:
description: Learn how to seamlessly render HTML documents in .NET applications using GroupDocs.Viewer for .NET.
type: docs
weight: 11
url: /net/rendering-documents-html/minify-html/
---
## Introduction
GroupDocs.Viewer for .NET is a powerful tool that enables developers to seamlessly render HTML documents within their .NET applications. With its intuitive API and robust functionality, developers can easily integrate document viewing capabilities into their applications, enhancing user experience and productivity.
## Prerequisites
Before diving into using GroupDocs.Viewer for .NET, ensure you have the following prerequisites:
### 1. Knowledge of C# and .NET Framework
To effectively utilize GroupDocs.Viewer for .NET, you should have a basic understanding of C# programming language and the .NET Framework.
### 2. Visual Studio IDE
Make sure you have Visual Studio IDE installed on your system. You can download it from the official website.
### 3. GroupDocs.Viewer for .NET Library
Download the GroupDocs.Viewer for .NET library from the provided [download link](https://releases.groupdocs.com/viewer/net/) and include it in your project.
### 4. Document Files
Prepare the document files that you want to render using GroupDocs.Viewer for .NET. Supported file formats include DOCX, PDF, PPTX, and more.
### 5. Temporary License (Optional)
If you're using GroupDocs.Viewer for .NET in a trial or testing environment, obtain a temporary license from the [temporary license page](https://purchase.groupdocs.com/temporary-license/).

## Complete Source Code
## Import Namespaces
In your .NET application, begin by importing the necessary namespaces to access the functionality of GroupDocs.Viewer for .NET.
```csharp
using System;
using System.IO;
using GroupDocs.Viewer.Options;
```

namespace GroupDocs.Viewer.Examples.CSharp.BasicUsage.RenderDocumentToHtml
Now, let's break down the process of minifying rendered HTML documents using GroupDocs.Viewer for .NET into multiple steps:
## Step 1: Define Output Directory
Specify the directory where you want to save the rendered HTML pages.
```csharp
string outputDirectory = "Your Document Directory";
```
## Step 2: Define Page File Path Format
Define the format of the file path for each rendered HTML page.
```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.html");
```
## Step 3: Render HTML Document
Instantiate a Viewer object and pass the path of the document file you want to render.
```csharp
using (Viewer viewer = new Viewer("Path_to_Your_Document"))
{
/// <summary>
/// This example demonstrates how to enable minification of HTML document.
/// </summary>
class MinifyHtmlDocument
{
public static void Run()
{
string outputDirectory = "Your Document Directory";
string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.html");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_DOCX))
{
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
options.Minify = true;

viewer.View(options);
}

Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
}
}
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
options.Minify = true;
viewer.View(options);
}

```
## Step 4: Display Success Message
Display a message indicating that the document has been successfully rendered.
```csharp
Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
```

## Conclusion
In conclusion, GroupDocs.Viewer for .NET offers a seamless solution for rendering HTML documents within .NET applications. By following the steps outlined in this tutorial, you can effortlessly integrate document viewing capabilities into your applications, enhancing user experience and productivity.
## FAQ's
### Can I render documents from external sources using GroupDocs.Viewer for .NET?
Yes, GroupDocs.Viewer for .NET supports rendering documents from various sources, including local files, streams, and URLs.
### Is there a free trial available for GroupDocs.Viewer for .NET?
Yes, you can obtain a free trial of GroupDocs.Viewer for .NET from the [official website](https://releases.groupdocs.com/).
### Does GroupDocs.Viewer for .NET support document conversion to other formats?
Yes, GroupDocs.Viewer for .NET provides APIs for converting documents to different formats such as PDF, HTML, and images.
### Can I customize the rendering options for documents in GroupDocs.Viewer for .NET?
Yes, you can customize various rendering options such as page orientation, quality, and watermarking according to your requirements.
### Where can I seek support for GroupDocs.Viewer for .NET?
You can seek support and engage with the community on the [GroupDocs.Viewer forum](https://forum.groupdocs.com/c/viewer/9).
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,108 @@
title: Render with Embedded or External Resources
linktitle: Render with Embedded or External Resources
second_title: GroupDocs.Viewer .NET API
description:
description: Enhance .NET document viewing with GroupDocs.Viewer for seamless rendering. Follow our tutorial for efficient integration and superior user experience.
type: docs
weight: 12
url: /net/rendering-documents-html/render-html-resources/
---
## Introduction

In the world of .NET development, efficient document viewing is a crucial aspect of many applications. GroupDocs.Viewer for .NET provides a powerful solution for rendering documents with embedded or external resources. In this tutorial, we'll explore how to utilize GroupDocs.Viewer to render documents seamlessly, breaking down each step for clarity and understanding.

## Prerequisites

Before diving into the tutorial, ensure you have the following prerequisites:

1. Basic Understanding of .NET Development: Familiarity with C# programming language and .NET framework is necessary.
2. Installation of GroupDocs.Viewer for .NET: Download and install GroupDocs.Viewer for .NET from [here](https://releases.groupdocs.com/viewer/net/).
3. Document File to Render: Prepare a sample document file (e.g., DOCX, PDF) for rendering.

## Import Namespaces

Firstly, let's import the necessary namespaces for our .NET project:

## Complete Source Code
```csharp
using System;
using System.IO;
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using System.IO;
```

Now, let's break down the process of rendering a document with embedded or external resources into manageable steps:

namespace GroupDocs.Viewer.Examples.CSharp.BasicUsage.RenderDocumentToHtml
## Step 1: Define Output Directory

```csharp
string outputDirectory = "Your Document Directory";
```

Specify the directory where you want the rendered HTML pages to be saved.

## Step 2: Define Page File Path Format

```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.html");
```

Set the format for the file path where each rendered page will be saved. `{0}` is a placeholder for page number.

## Step 3: Initialize Viewer Instance

```csharp
using (Viewer viewer = new Viewer("YourDocumentFilePath"))
{
/// <summary>
/// This example demonstrates how to render document into HTML with embedded resources.
/// </summary>
class RenderToHtmlWithEmbeddedResources
{
public static void Run()
{
string outputDirectory = "Your Document Directory";
string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.html");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_DOCX))
{
HtmlViewOptions options =
HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);

viewer.View(options);
}

Console.WriteLine($"\nSource document rendered successfully.\nCheck output in: {outputDirectory}");
}
}
// Viewer initialization code goes here
}
```

Create a Viewer instance by passing the path of the document file to be rendered.

## Step 4: Configure HTML View Options

```csharp
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
```

Configure HTML view options, specifying the format for embedded resources and page file path format.

## Step 5: Render Document

```csharp
viewer.View(options);
```

Invoke the `View` method on the Viewer instance, passing the configured HTML view options.

## Step 6: Display Output Directory Path

```csharp
Console.WriteLine($"\nSource document rendered successfully.\nCheck output in: {outputDirectory}");
```

Print a message indicating successful rendering along with the path of the output directory.

## Conclusion

GroupDocs.Viewer for .NET simplifies the process of rendering documents with embedded or external resources, enhancing document viewing capabilities in .NET applications. By following the steps outlined in this tutorial, developers can seamlessly integrate document rendering functionality into their projects, providing users with a smooth and efficient document viewing experience.

## FAQ's

### Q: Is GroupDocs.Viewer for .NET compatible with various document formats?

A: Yes, GroupDocs.Viewer supports a wide range of document formats, including DOCX, PDF, XLSX, and more.

### Q: Can I customize the rendering options according to my requirements?

A: Absolutely, GroupDocs.Viewer provides extensive options for configuring the rendering process to meet specific needs.

### Q: Is there a free trial available for GroupDocs.Viewer for .NET?

A: Yes, you can avail of a free trial from [here](https://releases.groupdocs.com/).

### Q: How can I get support or assistance with GroupDocs.Viewer integration?

A: You can seek help from the GroupDocs.Viewer community forum [here](https://forum.groupdocs.com/c/viewer/9).

### Q: Are temporary licenses available for testing purposes?

A: Yes, temporary licenses can be obtained from [here](https://purchase.groupdocs.com/temporary-license/).
Loading

0 comments on commit 2b125b9

Please sign in to comment.