In this how-to article, we will focus on the step-by-step procedure to convert EPS to JPG in C# by consuming one of the best document converter APIs. This article will also guide how to configure the document conversion package and provides a sample application for C# EPS to JPG converter to demonstrate the working of the feature. Here are the key steps and a sample code snippet for transforming EPS to JPG format.
Steps to Convert EPS to JPG in C#
- Install GroupDocs.Conversion for .NET package from the NuGet package manager in the .NET application to convert EPS to JPG
- Add a reference to the GroupDocs.Conversion namespace for converting from EPS to JPG format
- Create an instance of the Converter class for loading the input EPS file from the disk for transforming to JPG format
- Create and define properties for customizing the output JPG file
- Call the Convert method of the Converter class to save EPS as JPG on the disk
We have outlined all the steps that are necessary for creating the code to change EPS to JPG in C#. The above document transformation workflow is very straightforward and you can start with setting up the required package from the NuGet website and then include the necessary namespaces in the code. Once you are done with these steps, you have to load the input EPS file using the Converter class and define convert options for the output JPG file using the ImageConvertOptions object, and then finally call the Convert method for storing the resultant file on the disk.
Code to Convert EPS to JPG in C#
using System; | |
using GroupDocs.Conversion.Options.Convert; | |
namespace ConvertEpsToJpgInCSharp | |
{ | |
class Program | |
{ | |
public static void Main(string[] args) // Main function to convert EPS to JPG using C# | |
{ | |
// Remove the watermark in output JPG document by adding license | |
string licensePath = "GroupDocs.Conversion.lic"; | |
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License(); | |
lic.SetLicense(licensePath); | |
// Load the source EPS file for conversion to JPG | |
var converter = new GroupDocs.Conversion.Converter("sample.eps"); | |
// Set the conversion options for JPG document to customize the output file | |
ImageConvertOptions options = new ImageConvertOptions(); | |
// Convert and save the EPS in JPG format | |
converter.Convert("converted.jpg", options); | |
Console.WriteLine("Done"); | |
} | |
} | |
} |
In the preceding snippet, we have written the sample code to show you how to develop the functionality to convert EPS file to JPG using C#. This sample code is very easy to follow for doing document conversion which consists of a few lines of code and consumes a couple of API calls. You just need to copy this code into your projects, install the required conversion library and define paths for the files to execute it.
We have discussed the document conversion procedure to convert EPS to JPG in C# and developed an example for it. Recently, we published an article to change EPUB to PDF in C#, have a look at how to convert EPUB to PDF using C# guide for more information.