Converting EPS and PS file using Aspose .Net SDK

image.png (66.0 KB)

@Partha5590

To convert EPS and PS files using the Aspose .NET SDK, you can utilize the Aspose.Page for .NET library. This library is specifically designed for working with XPS and EPS/PS documents, allowing you to create, edit, and convert these file formats to various other formats, including images.

Here’s a basic example of how to convert an EPS file to a JPG image using Aspose.Page for .NET:

using Aspose.Page;
using Aspose.Page.XPS;

class Program
{
    static void Main(string[] args)
    {
        // Load the EPS file
        string epsFilePath = "input.eps";
        Document epsDocument = new Document(epsFilePath);

        // Save the EPS file as a JPG image
        string jpgFilePath = "output.jpg";
        epsDocument.Save(jpgFilePath, SaveFormat.Jpeg);
    }
}

In this example:

  1. You load the EPS file using the Document class.
  2. You then save it as a JPG image using the Save method, specifying the desired output format.

For more detailed information and additional functionalities, you can refer to the official documentation of Aspose.Page for .NET here and explore the API references for further capabilities.

If you have any specific requirements or encounter issues, feel free to ask for more assistance!

Sources:
[1]: Product Overview | Aspose.Page for .NET - Aspose Documentation

in java it is working
in c# it doesnt

@Partha5590

Would you please share your sample files and the sample code snippet with us? We will test the scenario in our environment and address it accordingly.

Import statement used by me
using Aspose.Words;
using Aspose.Cells;
using Aspose.Slides;
using Aspose.Slides.Export;
using Aspose.Words.Drawing;
using Aspose.Html;
using Aspose.Html.Rendering;
using Aspose.Html.Rendering.Pdf;
using Aspose.Slides.Export.Web;
using Aspose.Page.EPS;
using SaveFormat = Aspose.Slides.Export.SaveFormat;
using Microsoft.Extensions.Options;

var document = new Aspose.Page.EPS.PsDocument(“template.EPS”);

var options = new Aspose.Page.EPS.Device.ImageSaveOptions();

document.Save(“output.PDF”, options);

var documentPs = new Aspose.Page.PS.PsDocument(“template.PS”);

var optionsPs = new Aspose.Page.PS.Device.ImageSaveOptions();

documentPs.Save(“output.PDF”, optionsPs);

Hello @asad.ali

Even I tried with these below Code

PsDocument documenasdft = new PsDocument(input);
PdfSaveOptions option = new PdfSaveOptions();
documenasdft.SaveAsPdf(output, option);

I get below error
image.png (21.7 KB)

@asad.ali

I have changed a code a bit.

using Aspose.Words;
using Aspose.Cells;
using Aspose.Slides;
using Aspose.Slides.Export;
using Aspose.Words.Drawing;
using Aspose.Html;
using Aspose.Html.Rendering;
using Aspose.Html.Rendering.Pdf;
using Aspose.Slides.Export.Web;
using Aspose.Page.EPS;
using Aspose.Page.EPS.Device;

            PsDocument documenasdft = new PsDocument(input);
            Aspose.Page.EPS.Device.PdfSaveOptions options = new Aspose.Page.EPS.Device.PdfSaveOptions();
            documenasdft.SaveAsPdf(output, options);

I got below error →
System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See Deserialization risks in use of BinaryFormatter and related types - .NET | Microsoft Learn for more information.
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)

@Partha5590

Would you please share your sample EPS file in .zip format with us? Also, please share which .NET Framework are you using? We will test the scenario in our environment and address it accordingly.