Skip to content

Commit

Permalink
Updated image rendering examples
Browse files Browse the repository at this point in the history
  • Loading branch information
muqarrab-aspose committed Mar 12, 2024
1 parent 646f32b commit 451df10
Show file tree
Hide file tree
Showing 10 changed files with 722 additions and 523 deletions.
11 changes: 10 additions & 1 deletion content/english/net/image-rendering/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ url: /net/image-rendering/

## Image Rendering Tutorials
### [Render AI Images](./render-ai-images/)
Learn how to render AI images effortlessly in .NET applications using GroupDocs.Viewer for .NET. Follow our step-by-step tutorial for seamless integration.
### [Render APNG Images](./render-apng-images/)
Learn how to render APNG images in various formats using Groupdocs.Viewer for .NET. Step-by-step guide with code examples included.
### [Render CDR Images](./render-cdr-images/)
Learn how to render CDR images to HTML, JPG, PNG, and PDF using GroupDocs.Viewer for .NET. Easily convert CorelDRAW files with this tutorial.
### [Render CMX Images](./render-cmx-images/)
Learn how to effortlessly render CMX images into various formats using GroupDocs.Viewer for .NET. Enhance your document management.
### [Render EMZ and EMF Images](./render-emz-emf-images/)
Learn how to render EMZ and EMF images to various formats using GroupDocs.Viewer for .NET. Easy-to-follow tutorial for developers.
### [Render FODG and ODG Images](./render-fodg-odg-images/)
Learn how to render FODG and ODG images to HTML, JPG, PNG, and PDF using GroupDocs.Viewer for .NET. Enhance your document handling.
### [Render SVG and SVGZ Images](./render-svg-svgz-images/)
Learn how to render SVG and SVGZ images using GroupDocs.Viewer for .NET. Convert vector graphics into HTML, JPG, PNG, and PDF effortlessly.
### [Render TGA Images](./render-tga-images/)
### [Render WMZ and WMF Images](./render-wmz-wmf-images/)
Learn how to effortlessly render TGA images in .NET applications using GroupDocs.Viewer. Enhance your image rendering capabilities.
### [Render WMZ and WMF Images](./render-wmz-wmf-images/)
Effortlessly render WMZ and WMF images in .NET applications using GroupDocs.Viewer for .NET. Enhance document processing capabilities with ease.
119 changes: 64 additions & 55 deletions content/english/net/image-rendering/render-ai-images/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,80 @@
title: Render AI Images
linktitle: Render AI Images
second_title: GroupDocs.Viewer .NET API
description:
description: Learn how to render AI images effortlessly in .NET applications using GroupDocs.Viewer for .NET. Follow our step-by-step tutorial for seamless integration.
type: docs
weight: 10
url: /net/image-rendering/render-ai-images/
---
## Introduction
GroupDocs.Viewer for .NET is a powerful library that enables developers to effortlessly render various document formats within their .NET applications. Whether you need to display AI images, PDFs, or other document types, GroupDocs.Viewer simplifies the process, offering multiple output formats for seamless integration into your projects. This tutorial will guide you through rendering AI images step by step using GroupDocs.Viewer for .NET.
## Prerequisites
Before diving into the tutorial, ensure you have the following prerequisites:
1. Visual Studio: Install Visual Studio IDE on your system.
2. GroupDocs.Viewer for .NET: Download and install GroupDocs.Viewer for .NET from the [website](https://releases.groupdocs.com/viewer/net/).
3. Basic knowledge of C#: Familiarity with C# programming language is required to understand the code examples.

## Import Namespaces
In your C# project, import the necessary namespaces to access the functionalities of GroupDocs.Viewer for .NET.

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

namespace GroupDocs.Viewer.Examples.CSharp.AdvancedUsage.Rendering.RenderingOptionsByDocumentType.RenderingImageFiles
Rendering AI images with GroupDocs.Viewer for .NET involves several steps, each catering to a specific output format. Below, we'll break down the process into individual steps for clarity.
## Step 1: Specify Output Directory
```csharp
string outputDirectory = "Your Document Directory";
```
## Step 2: Rendering to HTML
```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.html");
using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
/// <summary>
/// This example demonstrates how to render Ai document into HTML, JPG, PNG, PDF.
/// </summary>
public class RenderingAi
{
public static void Run()
{
string outputDirectory = "Your Document Directory";
string pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.html");

// TO HTML
using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);

viewer.View(options);
}

// TO JPG
pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.jpg");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);

viewer.View(options);
}

// TO PNG
pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.png");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
PngViewOptions options = new PngViewOptions(pageFilePathFormat);

viewer.View(options);
}

// TO PDF
pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.pdf");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);

viewer.View(options);
}

Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
}
}
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
viewer.View(options);
}
```
## Step 3: Rendering to JPG
```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.jpg");
using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
viewer.View(options);
}
```
## Step 4: Rendering to PNG
```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.png");
using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
PngViewOptions options = new PngViewOptions(pageFilePathFormat);
viewer.View(options);
}

```
## Step 5: Rendering to PDF
```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "ai_result.pdf");
using (Viewer viewer = new Viewer(TestFiles.SAMPLE_AI))
{
PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
viewer.View(options);
}
```

## Conclusion
GroupDocs.Viewer for .NET offers a seamless solution for rendering AI images and various document formats within .NET applications. By following the step-by-step guide provided in this tutorial, developers can effortlessly integrate document rendering capabilities into their projects.
## FAQ's
### Can I customize the output appearance when rendering AI images?
Yes, GroupDocs.Viewer for .NET provides various options for customizing the output appearance, including page size, image quality, and more.
### Is there a trial version available for testing purposes?
Yes, you can download a free trial version from the GroupDocs [website](https://releases.groupdocs.com/viewer/net/) to evaluate the library's features before making a purchase.
### Does GroupDocs.Viewer support rendering encrypted AI images?
Yes, GroupDocs.Viewer for .NET supports rendering encrypted AI images with appropriate decryption keys provided.
### Can I render AI images from URLs directly?
Yes, GroupDocs.Viewer for .NET allows rendering AI images from URLs by specifying the URL path instead of a local file path.
### Is technical support available for GroupDocs.Viewer for .NET?
Yes, technical support is available through the GroupDocs [forum](https://forum.groupdocs.com/c/viewer/9), where you can ask questions, report issues, and seek assistance from the community.
170 changes: 115 additions & 55 deletions content/english/net/image-rendering/render-apng-images/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,132 @@
title: Render APNG Images
linktitle: Render APNG Images
second_title: GroupDocs.Viewer .NET API
description:
description: Learn how to render APNG images in various formats using Groupdocs.Viewer for .NET. Step-by-step guide with code examples included.
type: docs
weight: 11
url: /net/image-rendering/render-apng-images/
---
##Introduction
Groupdocs.Viewer for .NET is a powerful tool that allows developers to seamlessly render various document formats in their .NET applications. Among its many features, it provides robust functionality for rendering APNG (Animated Portable Network Graphics) images, enabling developers to display APNG images in different formats such as HTML, JPG, PNG, and PDF.

In this tutorial, we'll explore how to utilize Groupdocs.Viewer for .NET to render APNG images step by step. By following these instructions, you'll be able to integrate APNG image rendering capabilities into your .NET applications effortlessly.

##Prerequisites:

Before we dive into the tutorial, make sure you have the following prerequisites in place:

1. Groupdocs.Viewer for .NET Installation: Ensure that you have Groupdocs.Viewer for .NET installed in your development environment. You can download the necessary files from the [official download link](https://releases.groupdocs.com/viewer/net/).

2. Basic Knowledge of .NET Development: Familiarize yourself with .NET development concepts, including C# programming and handling dependencies within your projects.

3. Sample APNG Image: Have a sample APNG image file ready for testing purposes. You can use any APNG image file available or create one to experiment with the rendering process.

Now, let's proceed with the step-by-step guide to render APNG images using Groupdocs.Viewer for .NET.

## Importing Necessary Namespaces

Before we begin rendering APNG images, we need to import the required namespaces into our C# code. These namespaces provide access to the classes and methods necessary for interacting with Groupdocs.Viewer functionalities.

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

## Step 1: Initialize Output Directory

First, we need to define the directory where the rendered output will be stored. We'll create a string variable to hold the output directory path.

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

Replace `"Your Document Directory"` with the actual path where you want the rendered files to be saved.

namespace GroupDocs.Viewer.Examples.CSharp.AdvancedUsage.Rendering.RenderingOptionsByDocumentType.RenderingImageFiles
## Step 2: Render APNG Image to HTML

To render the APNG image to HTML format, we'll use the `Viewer` class from Groupdocs.Viewer and specify the output options accordingly.

```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "apng_result.html");

using (Viewer viewer = new Viewer("Path_to_your_APNG_file"))
{
/// <summary>
/// This example demonstrates how to render Animated PNG format
/// </summary>
public class RenderingApng
{
public static void Run()
{
string outputDirectory = "Your Document Directory";
string pageFilePathFormat = Path.Combine(outputDirectory, "apng_result.html");

// TO HTML
using (Viewer viewer = new Viewer(TestFiles.SAMPLE_APNG))
{
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);

viewer.View(options);
}


// TO JPG
pageFilePathFormat = Path.Combine(outputDirectory, "apng_result_{0}.jpg");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_APNG))
{
JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);

viewer.View(options);
}

// TO PNG
pageFilePathFormat = Path.Combine(outputDirectory, "apng_result_{0}.png");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_APNG))
{
PngViewOptions options = new PngViewOptions(pageFilePathFormat);

viewer.View(options);
}

// TO PDF
pageFilePathFormat = Path.Combine(outputDirectory, "apng_result.pdf");

using (Viewer viewer = new Viewer(TestFiles.SAMPLE_APNG))
{
PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);

viewer.View(options);
}

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

viewer.View(options);
}
```

Replace `"Path_to_your_APNG_file"` with the actual path to your APNG image file.

## Step 3: Render APNG Image to JPG

Similarly, we can render the APNG image to JPG format by configuring the appropriate options.

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

using (Viewer viewer = new Viewer("Path_to_your_APNG_file"))
{
JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);

viewer.View(options);
}
```

## Step 4: Render APNG Image to PNG

Rendering the APNG image to PNG format follows the same pattern, adjusting the options accordingly.

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

using (Viewer viewer = new Viewer("Path_to_your_APNG_file"))
{
PngViewOptions options = new PngViewOptions(pageFilePathFormat);

viewer.View(options);
}
```

## Step 5: Render APNG Image to PDF

Lastly, we can render the APNG image to PDF format using Groupdocs.Viewer.

```csharp
string pageFilePathFormat = Path.Combine(outputDirectory, "apng_result.pdf");

using (Viewer viewer = new Viewer("Path_to_your_APNG_file"))
{
PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);

viewer.View(options);
}
```

## Conclusion

In this tutorial, we've learned how to render APNG images to various formats using Groupdocs.Viewer for .NET. By following the step-by-step guide and incorporating the provided code snippets into your .NET application, you can seamlessly integrate APNG image rendering capabilities, enhancing the visual experience for your users.

## FAQ's

### Q1: Can Groupdocs.Viewer render other image formats apart from APNG?

A1: Yes, Groupdocs.Viewer supports rendering various image formats, including PNG, JPG, BMP, TIFF, and GIF, among others.

### Q2: Is Groupdocs.Viewer compatible with .NET Core applications?

A2: Yes, Groupdocs.Viewer offers compatibility with both .NET Framework and .NET Core applications, providing flexibility for developers.

### Q3: Does Groupdocs.Viewer require any additional dependencies for rendering documents?

A3: Groupdocs.Viewer comes with all necessary dependencies bundled, eliminating the need for additional installations or configurations.

### Q4: Can I customize the rendering options for better performance or visual quality?

A4: Yes, Groupdocs.Viewer offers extensive customization options, allowing developers to tailor the rendering process according to their specific requirements.

### Q5: Is technical support available for Groupdocs.Viewer users?

A5: Yes, Groupdocs provides dedicated technical support for its products, including Groupdocs.Viewer. You can access support through the [official forum](https://forum.groupdocs.com/c/viewer/9) or contact the support team directly.
Loading

0 comments on commit 451df10

Please sign in to comment.